From 30613a47ae17d3df4ffcb17c91f939b9364846cc Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 3 Jul 2018 20:21:24 +0900 Subject: [PATCH] Fixed session locking at login. This resolves bug 2874. Partially cherry picked from commit a359fef2. Signed-off-by: Michele Calgaro --- kdesktop/CMakeLists.txt | 2 ++ kdesktop/lockeng.cc | 26 ++++++++++++++++++++++++++ starttde | 12 ------------ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/kdesktop/CMakeLists.txt b/kdesktop/CMakeLists.txt index 45cc9e9ed..fcb84a66a 100644 --- a/kdesktop/CMakeLists.txt +++ b/kdesktop/CMakeLists.txt @@ -81,6 +81,8 @@ tde_add_executable( kxdglauncher ##### kdesktop (tdeinit) ######################## set( target kdesktop ) +set_source_files_properties( lockeng.cc PROPERTIES COMPILE_FLAGS -DKDE_CONFDIR=\\"${TDE_CONFIG_DIR}\\" ) + set( ${target}_SRCS main.cc krootwm.cc xautolock.cc kdiconview.cc init.cc diff --git a/kdesktop/lockeng.cc b/kdesktop/lockeng.cc index bb363dcb8..80292b577 100644 --- a/kdesktop/lockeng.cc +++ b/kdesktop/lockeng.cc @@ -10,10 +10,12 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -158,6 +160,30 @@ SaverEngine::SaverEngine() sigaddset(&mThreadBlockSet, SIGTTIN); pthread_sigmask(SIG_BLOCK, &mThreadBlockSet, NULL); + // Wait for the saver process to signal ready... + if (!waitForLockProcessStart()) { + kdDebug( 1204 ) << "Failed to initialize kdesktop_lock (unexpected termination)!" << endl; + } + + // lock the desktop if required + KSimpleConfig *config; + struct stat st; + if (stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st) == 0) { + config = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" )); + } + else { + config = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" )); + } + config->setGroup("X-:0-Core"); + bool autoLoginEnable = config->readBoolEntry("AutoLoginEnable", false); + bool autoLoginLocked = config->readBoolEntry("AutoLoginLocked", false); + if (autoLoginEnable && autoLoginLocked) { + mLockProcess.kill(SIGTTOU); + mLockProcess.kill(SIGUSR1); + } + delete config; + config = NULL; + dBusConnect(); } diff --git a/starttde b/starttde index c237652c7..ba025d819 100755 --- a/starttde +++ b/starttde @@ -745,18 +745,6 @@ if test $? -ne 0; then fi echo "[starttde] tdeinit started successfully." 1>&2 -# If the session should be locked from the start (locked autologin), -# lock now and do the rest of the TDE startup underneath the locker. -# FIXME -# kdesktop needs to be notified of this locker process somehow so that -# it does not attempt to launch its own locker process on startup! -if test -n "$dl"; then - $TDEDIR/bin/kwrapper kdesktop_lock --forcelock & - # Give it some time for starting up. This is somewhat unclean; some - # notification would be better. - sleep 1 -fi - # Finally, give the session control to the session manager. # See tdebase/ksmserver for the description of the rest of the startup sequence. # When set, the TDEWM environment variable will be used as Trinity's