diff options
Diffstat (limited to 'kdesktop/lock/lockprocess.cpp')
-rw-r--r-- | kdesktop/lock/lockprocess.cpp | 256 |
1 files changed, 130 insertions, 126 deletions
diff --git a/kdesktop/lock/lockprocess.cpp b/kdesktop/lock/lockprocess.cpp index f493649f1..2ad89f5ab 100644 --- a/kdesktop/lock/lockprocess.cpp +++ b/kdesktop/lock/lockprocess.cpp @@ -38,7 +38,7 @@ #include <dmctl.h> #include <dcopref.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdeapplication.h> #include <kservicegroup.h> #include <kdebug.h> @@ -85,7 +85,7 @@ #include <sys/types.h> #include <fcntl.h> -#include <kcrash.h> +#include <tdecrash.h> #include <pthread.h> @@ -151,14 +151,6 @@ Atom kde_wm_system_modal_notification = 0; Atom kde_wm_transparent_to_desktop = 0; Atom kde_wm_transparent_to_black = 0; -static void segv_handler(int) -{ - kdError(KDESKTOP_DEBUG_ID) << "A fatal exception was encountered." - << " Trapping and ignoring it so as not to compromise desktop security..." - << kdBacktrace() << endl; - sleep(1); -} - extern Atom tqt_wm_state; extern bool trinity_desktop_lock_use_system_modal_dialogs; extern bool trinity_desktop_lock_delay_screensaver_start; @@ -166,24 +158,32 @@ extern bool trinity_desktop_lock_use_sak; 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 trinity_desktop_lock_failed_grab; 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_autohide_lockdlg = true; + +static void segv_handler(int) +{ + kdError(KDESKTOP_DEBUG_ID) << "A fatal exception was encountered." + << " Trapping and ignoring it so as not to compromise desktop security..." + << kdBacktrace() << endl; + + sleep(1); +} #define ENABLE_CONTINUOUS_LOCKDLG_DISPLAY \ -if (!mForceContinualLockDisplayTimer->isActive()) mForceContinualLockDisplayTimer->start(100, FALSE); \ -trinity_desktop_lock_autohide_lockdlg = FALSE; \ +if (!mForceContinualLockDisplayTimer->isActive()) mForceContinualLockDisplayTimer->start(100, false); \ +trinity_desktop_lock_autohide_lockdlg = false; \ mHackDelayStartupTimer->stop(); #define DISABLE_CONTINUOUS_LOCKDLG_DISPLAY \ mForceContinualLockDisplayTimer->stop(); \ -trinity_desktop_lock_autohide_lockdlg = TRUE; \ +trinity_desktop_lock_autohide_lockdlg = true; \ mHackDelayStartupTimer->stop(); //=========================================================================== @@ -234,7 +234,9 @@ LockProcess::LockProcess() m_notifyReadyRequested(false), m_loginCardDevice(NULL), m_maskWidget(NULL), - m_saverRootWindow(0) + m_saverRootWindow(0), + mControlPipeHandler(nullptr), + mControlPipeHandlerThread(nullptr) { #ifdef KEEP_MOUSE_UNGRABBED setNFlags(WX11DisableMove|WX11DisableClose|WX11DisableShade|WX11DisableMinimize|WX11DisableMaximize); @@ -247,7 +249,7 @@ LockProcess::LockProcess() kde_wm_transparent_to_desktop = XInternAtom(tqt_xdisplay(), "_TDE_TRANSPARENT_TO_DESKTOP", False); kde_wm_transparent_to_black = XInternAtom(tqt_xdisplay(), "_TDE_TRANSPARENT_TO_BLACK", False); - kapp->installX11EventFilter(this); + tdeApp->installX11EventFilter(this); mForceContinualLockDisplayTimer = new TQTimer( this ); mHackDelayStartupTimer = new TQTimer( this ); @@ -256,7 +258,7 @@ LockProcess::LockProcess() if (!argb_visual) { // Try to get the root pixmap if (!m_rootPixmap) m_rootPixmap = new KRootPixmap(this); - connect(m_rootPixmap, TQT_SIGNAL(backgroundUpdated(const TQPixmap &)), this, TQT_SLOT(slotPaintBackground(const TQPixmap &))); + connect(m_rootPixmap, TQ_SIGNAL(backgroundUpdated(const TQPixmap &)), this, TQ_SLOT(slotPaintBackground(const TQPixmap &))); m_rootPixmap->setCustomPainting(true); m_rootPixmap->start(); } @@ -305,9 +307,9 @@ LockProcess::LockProcess() TDEGenericHardwareList cardReaderList = hwdevices->listByDeviceClass(TDEGenericDeviceType::CryptographicCard); for (hwdevice = cardReaderList.first(); hwdevice; hwdevice = cardReaderList.next()) { TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice); - // connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); - connect(cdevice, TQT_SIGNAL(certificateListAvailable(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardInserted(TDECryptographicCardDevice*))); - connect(cdevice, TQT_SIGNAL(cardRemoved(TDECryptographicCardDevice*)), this, TQT_SLOT(cryptographicCardRemoved(TDECryptographicCardDevice*))); + // connect(cdevice, TQ_SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*))); + connect(cdevice, TQ_SIGNAL(certificateListAvailable(TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardInserted(TDECryptographicCardDevice*))); + connect(cdevice, TQ_SIGNAL(cardRemoved(TDECryptographicCardDevice*)), this, TQ_SLOT(cryptographicCardRemoved(TDECryptographicCardDevice*))); cdevice->enableCardMonitoring(true); // cdevice->enablePINEntryCallbacks(true); } @@ -331,8 +333,6 @@ LockProcess::~LockProcess() mControlPipeHandler->terminateThread(); mControlPipeHandlerThread->wait(); delete mControlPipeHandler; -// delete mControlPipeHandlerThread; - if (resizeTimer != NULL) { resizeTimer->stop(); delete resizeTimer; @@ -388,12 +388,12 @@ void LockProcess::init(bool child, bool useBlankOnly) generateBackingImages(); // Connect all signals - connect( mForceContinualLockDisplayTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(displayLockDialogIfNeeded()) ); - connect( mHackDelayStartupTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(closeDialogAndStartHack()) ); - connect( mEnsureVRootWindowSecurityTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(repaintRootWindowIfNeeded()) ); - connect(tqApp, TQT_SIGNAL(mouseInteraction(XEvent *)), TQT_SLOT(slotMouseActivity(XEvent *))); - connect(&mHackProc, TQT_SIGNAL(processExited(TDEProcess *)), TQT_SLOT(hackExited(TDEProcess *))); - connect(&mSuspendTimer, TQT_SIGNAL(timeout()), TQT_SLOT(suspend())); + connect( mForceContinualLockDisplayTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(displayLockDialogIfNeeded()) ); + connect( mHackDelayStartupTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(closeDialogAndStartHack()) ); + connect( mEnsureVRootWindowSecurityTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(repaintRootWindowIfNeeded()) ); + connect(tqApp, TQ_SIGNAL(mouseInteraction(XEvent *)), TQ_SLOT(slotMouseActivity(XEvent *))); + connect(&mHackProc, TQ_SIGNAL(processExited(TDEProcess *)), TQ_SLOT(hackExited(TDEProcess *))); + connect(&mSuspendTimer, TQ_SIGNAL(timeout()), TQ_SLOT(suspend())); #ifdef HAVE_DPMS //if the user decided that the screensaver should run independent from @@ -403,7 +403,7 @@ void LockProcess::init(bool child, bool useBlankOnly) CARD16 state; if (DPMSInfo(tqt_xdisplay(), &state, &on)) { if (on) { - connect(&mCheckDPMS, TQT_SIGNAL(timeout()), TQT_SLOT(checkDPMSActive())); + connect(&mCheckDPMS, TQ_SIGNAL(timeout()), TQ_SLOT(checkDPMSActive())); // we can save CPU if we stop it as quickly as possible // but we waste CPU if we check too often -> so take 10s mCheckDPMS.start(10000); @@ -412,9 +412,7 @@ void LockProcess::init(bool child, bool useBlankOnly) } #endif -#if (TQT_VERSION-0 >= 0x030200) // XRANDR support - connect( kapp->desktop(), TQT_SIGNAL( resized( int )), TQT_SLOT( desktopResized())); -#endif + connect( tdeApp->desktop(), TQ_SIGNAL( resized( int )), TQ_SLOT( desktopResized())); if (!trinity_desktop_lock_use_system_modal_dialogs) { setWFlags((WFlags)WX11BypassWM); @@ -435,21 +433,25 @@ void LockProcess::init(bool child, bool useBlankOnly) mControlPipeHandler = new ControlPipeHandlerObject(); mControlPipeHandler->mParent = this; mControlPipeHandler->moveToThread(mControlPipeHandlerThread); - TQObject::connect(mControlPipeHandler, SIGNAL(processCommand(TQString)), this, SLOT(processInputPipeCommand(TQString))); - TQTimer::singleShot(0, mControlPipeHandler, SLOT(run())); + TQObject::connect(mControlPipeHandler, TQ_SIGNAL(processCommand(TQString)), this, TQ_SLOT(processInputPipeCommand(TQString))); + TQTimer::singleShot(0, mControlPipeHandler, TQ_SLOT(run())); mControlPipeHandlerThread->start(); + // If the lock process terminates before 'mControlPipeHandler::run()' has been called, the + // 'mControlPipeHandlerThread' thread would not terminate and the lock process would have a + // dirty exit, potentially leaving 'kdesktop' in a dirty state that prevents the lock from + // working correctly till 'kdesktop' is killed and restarted. By forcing a call to 'processEvents()' + // we make sure to handle pending timer events and execute the required call + tdeApp->processEvents(); } static int signal_pipe[2]; static void sigterm_handler(int) { - if ((!trinity_desktop_lock_process) || (!trinity_desktop_lock_process->inSecureDialog())) { - // Exit uncleanly - char tmp = 'U'; - if (::write( signal_pipe[1], &tmp, 1) == -1) { - // Error handler to shut up gcc warnings - } + // Exit uncleanly + char tmp = 'U'; + if (::write( signal_pipe[1], &tmp, 1) == -1) { + // Error handler to shut up gcc warnings } } @@ -463,7 +465,7 @@ static void sighup_handler(int) bool LockProcess::closeCurrentWindow() { - mClosingWindows = TRUE; + mClosingWindows = true; if (currentDialog != NULL) { mForceReject = true; if (dynamic_cast<SAKDlg*>(currentDialog)) { @@ -478,12 +480,12 @@ bool LockProcess::closeCurrentWindow() } if( mDialogs.isEmpty() ) { - mClosingWindows = FALSE; + mClosingWindows = false; mForceReject = false; return false; } else { - mClosingWindows = TRUE; + mClosingWindows = true; return true; } } @@ -534,7 +536,7 @@ void LockProcess::setupSignals() // Error handler to shut up gcc warnings } TQSocketNotifier* notif = new TQSocketNotifier(signal_pipe[0], TQSocketNotifier::Read, this ); - connect( notif, TQT_SIGNAL(activated(int)), TQT_SLOT(signalPipeSignal())); + connect( notif, TQ_SIGNAL(activated(int)), TQ_SLOT(signalPipeSignal())); } @@ -552,9 +554,11 @@ void LockProcess::signalPipeSignal() startLock(); } else if( tmp == 'U' ) { - // Exit uncleanly - quitSaver(); - exit(1); + if (!inSecureDialog()) { + // Exit uncleanly + quitSaver(); + exit(1); + } } } @@ -566,7 +570,7 @@ bool LockProcess::lock() m_startupStatusDialog->setStatusMessage(i18n("Securing desktop session").append("...")); m_startupStatusDialog->show(); m_startupStatusDialog->setActiveWindow(); - tqApp->processEvents(); + tdeApp->processEvents(); #endif if (startSaver(true)) { @@ -577,7 +581,7 @@ bool LockProcess::lock() // selecting "lock screen", that looks really untidy. mBusy = true; if (startLock()) { - TQTimer::singleShot(1000, this, TQT_SLOT(slotDeadTimePassed())); + TQTimer::singleShot(1000, this, TQ_SLOT(slotDeadTimePassed())); return true; } stopSaver(); @@ -598,7 +602,7 @@ bool LockProcess::defaultSave() mOverrideHackStartupEnabled = true; if (startSaver()) { if (mLockGrace >= 0) { - TQTimer::singleShot(mLockGrace, this, TQT_SLOT(startLock())); + TQTimer::singleShot(mLockGrace, this, TQ_SLOT(startLock())); } return true; } @@ -618,18 +622,18 @@ void LockProcess::quitSaver() { DISABLE_CONTINUOUS_LOCKDLG_DISPLAY if (closeCurrentWindow()) { - TQTimer::singleShot( 0, this, SLOT(quitSaver()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(quitSaver()) ); return; } stopSaver(); - kapp->quit(); + tdeApp->quit(); } //--------------------------------------------------------------------------- void LockProcess::startSecureDialog() { if ((backingPixmap.isNull()) && (mBackingStartupDelayTimer < 100)) { - TQTimer::singleShot(10, this, TQT_SLOT(startSecureDialog())); + TQTimer::singleShot(10, this, TQ_SLOT(startSecureDialog())); mBackingStartupDelayTimer++; return; } @@ -650,7 +654,7 @@ void LockProcess::startSecureDialog() mInSecureDialog = false; if (ret == 0) { mClosingWindows = 1; - kapp->quit(); + tdeApp->quit(); } if (ret == 1) { // In case of a forced lock we don't react to events during @@ -668,11 +672,11 @@ void LockProcess::startSecureDialog() mBusy = false; } else { - TQTimer::singleShot(1000, this, TQT_SLOT(slotDeadTimePassed())); + TQTimer::singleShot(1000, this, TQ_SLOT(slotDeadTimePassed())); } 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); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { if (mHackStartupEnabled == true) { @@ -681,7 +685,7 @@ void LockProcess::startSecureDialog() else { if (trinity_desktop_lock_use_system_modal_dialogs == true) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { startHack(); @@ -699,18 +703,18 @@ void LockProcess::startSecureDialog() if (system("ksysguard &") == -1) { // Error handler to shut up gcc warnings } - kapp->quit(); + tdeApp->quit(); } if (ret == 3) { mClosingWindows = 1; DCOPRef("ksmserver","ksmserver").send("logout", (int)TDEApplication::ShutdownConfirmYes, (int)TDEApplication::ShutdownTypeNone, (int)TDEApplication::ShutdownModeInteractive); - kapp->quit(); + tdeApp->quit(); } // FIXME // Handle remaining case (switch user) if (forcecontdisp) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } stopSaver(); } @@ -722,13 +726,13 @@ bool LockProcess::runSecureDialog() m_startupStatusDialog->setStatusMessage(i18n("Securing desktop session").append("...")); m_startupStatusDialog->show(); m_startupStatusDialog->setActiveWindow(); - tqApp->processEvents(); + tdeApp->processEvents(); #endif mInSecureDialog = true; if (startSaver()) { mBackingStartupDelayTimer = 0; - TQTimer::singleShot(0, this, TQT_SLOT(startSecureDialog())); + TQTimer::singleShot(0, this, TQ_SLOT(startSecureDialog())); return true; } else { @@ -798,9 +802,9 @@ void LockProcess::readSaver() if (!mSaver.isEmpty()) { TQString file = locate("scrsav", mSaver); - bool opengl = kapp->authorize("opengl_screensavers"); - bool manipulatescreen = kapp->authorize("manipulatescreen_screensavers"); - KDesktopFile config(file, true); + bool opengl = tdeApp->authorize("opengl_screensavers"); + bool manipulatescreen = tdeApp->authorize("manipulatescreen_screensavers"); + TDEDesktopFile config(file, true); if (config.readEntry("X-TDE-Type").utf8() != 0) { TQString saverType = config.readEntry("X-TDE-Type").utf8(); TQStringList saverTypes = TQStringList::split(";", saverType); @@ -1040,7 +1044,7 @@ void LockProcess::desktopResized() } else { mEnsureScreenHiddenTimer = new TQTimer( this ); - connect( mEnsureScreenHiddenTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotForcePaintBackground()) ); + connect( mEnsureScreenHiddenTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(slotForcePaintBackground()) ); } mEnsureScreenHiddenTimer->start(DESKTOP_WALLPAPER_OBTAIN_TIMEOUT_MS, true); } @@ -1063,9 +1067,9 @@ void LockProcess::desktopResized() // being displayed, so we finish the hack restarting/display prettying operations in a separate timed slot if (resizeTimer == NULL) { resizeTimer = new TQTimer( this ); - connect( resizeTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(doDesktopResizeFinish()) ); + connect( resizeTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(doDesktopResizeFinish()) ); } - resizeTimer->start( 100, TRUE ); // 100 millisecond single shot timer; should allow display switching operations to finish before hack is started + resizeTimer->start( 100, true ); // 100 millisecond single shot timer; should allow display switching operations to finish before hack is started } void LockProcess::doDesktopResizeFinish() @@ -1075,7 +1079,7 @@ void LockProcess::doDesktopResizeFinish() } mDialogControlLock = true; if (closeCurrentWindow()) { - TQTimer::singleShot( 0, this, SLOT(doDesktopResizeFinish()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(doDesktopResizeFinish()) ); mDialogControlLock = false; return; } @@ -1084,7 +1088,7 @@ void LockProcess::doDesktopResizeFinish() // Restart the hack as the window size is now different if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { if (mHackStartupEnabled == true) { @@ -1093,7 +1097,7 @@ void LockProcess::doDesktopResizeFinish() else { if (trinity_desktop_lock_use_system_modal_dialogs == true) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { startHack(); @@ -1343,6 +1347,7 @@ bool LockProcess::startSaver(bool notify_ready) if (!child_saver && !grabInput()) { kdWarning(KDESKTOP_DEBUG_ID) << "LockProcess::startSaver() grabInput() failed!!!!" << endl; + trinity_desktop_lock_failed_grab = true; return false; } mBusy = false; @@ -1354,7 +1359,7 @@ bool LockProcess::startSaver(bool notify_ready) if (mParent) { TQSocketNotifier *notifier = new TQSocketNotifier(mParent, TQSocketNotifier::Read, this, "notifier"); - connect(notifier, TQT_SIGNAL( activated (int)), TQT_SLOT( quitSaver())); + connect(notifier, TQ_SIGNAL( activated (int)), TQ_SLOT( quitSaver())); } createSaverWindow(); move(0, 0); @@ -1370,7 +1375,8 @@ bool LockProcess::startSaver(bool notify_ready) slotPaintBackground(rootWinSnapShot); } - if (((!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced)) && (!mInSecureDialog)) && (mHackStartupEnabled || mOverrideHackStartupEnabled)) { + if (!(trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) && !mInSecureDialog && + (mHackStartupEnabled || mOverrideHackStartupEnabled)) { if (argb_visual) { setTransparentBackgroundARGB(); } @@ -1397,10 +1403,10 @@ bool LockProcess::startSaver(bool notify_ready) } } - if (mInSecureDialog == FALSE) { + if (!mInSecureDialog) { 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); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { if (mHackStartupEnabled || mOverrideHackStartupEnabled) { @@ -1410,7 +1416,7 @@ bool LockProcess::startSaver(bool notify_ready) else { if (trinity_desktop_lock_use_system_modal_dialogs == true) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { startHack(); @@ -1529,7 +1535,7 @@ void LockProcess::closeDialogAndStartHack() // Make sure saver will attempt to start again after DPMS wakeup // This is related to Bug 1475 ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); // Should not start saver here, because the DPMS check method below would turn it right back off! // This is related to Bug 1475 return; @@ -1542,7 +1548,7 @@ void LockProcess::closeDialogAndStartHack() DISABLE_CONTINUOUS_LOCKDLG_DISPLAY mSuspended = true; if (closeCurrentWindow()) { - TQTimer::singleShot( 0, this, SLOT(closeDialogAndStartHack()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(closeDialogAndStartHack()) ); } else { resume(true); @@ -1577,10 +1583,10 @@ void LockProcess::repaintRootWindowIfNeeded() bool LockProcess::startHack() { - mHackActive = TRUE; + mHackActive = true; if ((mEnsureVRootWindowSecurityTimer) && (!mEnsureVRootWindowSecurityTimer->isActive())) { - mEnsureVRootWindowSecurityTimer->start(250, FALSE); + mEnsureVRootWindowSecurityTimer->start(250, false); } if (currentDialog || (!mDialogs.isEmpty())) { @@ -1669,7 +1675,7 @@ bool LockProcess::startHack() if (trinity_desktop_lock_delay_screensaver_start && trinity_desktop_lock_forced) { // Close any active dialogs if (closeCurrentWindow()) { - TQTimer::singleShot( 0, this, SLOT(closeCurrentWindow()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(closeCurrentWindow()) ); } } if (m_startupStatusDialog) { m_startupStatusDialog->closeSMDialog(); m_startupStatusDialog=NULL; } @@ -1709,7 +1715,7 @@ bool LockProcess::startHack() } if (trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } saverReadyIfNeeded(); } @@ -1735,7 +1741,7 @@ void LockProcess::stopHack() } setCursor( TQt::arrowCursor ); - mHackActive = FALSE; + mHackActive = false; } //--------------------------------------------------------------------------- @@ -1744,7 +1750,7 @@ void LockProcess::hackExited(TDEProcess *) { // Hack exited while we're supposed to be saving the screen. // Make sure the saver window is black. - mHackActive = FALSE; + mHackActive = false; usleep(100); TQApplication::syncX(); if (!trinity_desktop_lock_use_system_modal_dialogs) { @@ -1779,7 +1785,7 @@ void LockProcess::hackExited(TDEProcess *) if (!mSuspended) { if (trinity_desktop_lock_use_system_modal_dialogs) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } } saverReadyIfNeeded(); @@ -1791,19 +1797,17 @@ void LockProcess::displayLockDialogIfNeeded() m_startupStatusDialog->closeSMDialog(); m_startupStatusDialog = NULL; } - if (!mInSecureDialog) { - if (trinity_desktop_lock_use_system_modal_dialogs) { - if (!mBusy) { - mBusy = true; - if (mLocked) { - if (checkPass()) { - mClosingWindows = true; - stopSaver(); - kapp->quit(); - } + if (!mInSecureDialog && trinity_desktop_lock_use_system_modal_dialogs) { + if (!mBusy) { + mBusy = true; + if (mLocked) { + if (checkPass()) { + mClosingWindows = true; + stopSaver(); + tdeApp->quit(); } - mBusy = false; } + mBusy = false; } } } @@ -1816,7 +1820,7 @@ void LockProcess::suspend() stopHack(); ENABLE_CONTINUOUS_LOCKDLG_DISPLAY if (mHackStartupEnabled) { - mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } } else { @@ -1834,7 +1838,7 @@ void LockProcess::suspend() } hackstat[8191] = 0; hackStatus = hackstat; - hackStatus = hackStatus.remove(TQRegExp("(*) ", TRUE, TRUE)); + hackStatus = hackStatus.remove(TQRegExp("(*) ", true, true)); TQStringList hackStatusList = TQStringList::split(" ", hackStatus); hackStatus = (*(hackStatusList.at(1))); } @@ -2026,10 +2030,10 @@ int LockProcess::execDialog( TQDialog *dlg ) // Slight delay before screensaver resume to allow the dialog window to fully disappear if (hackResumeTimer == NULL) { hackResumeTimer = new TQTimer( this ); - connect( hackResumeTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(resumeUnforced()) ); + connect( hackResumeTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(resumeUnforced()) ); } if (mResizingDesktopLock == false) { - hackResumeTimer->start( 10, TRUE ); + hackResumeTimer->start( 10, true ); } } else { @@ -2065,7 +2069,7 @@ void LockProcess::slotPaintBackground(const TQPixmap &rpm) } else { mEnsureScreenHiddenTimer = new TQTimer( this ); - connect( mEnsureScreenHiddenTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotForcePaintBackground()) ); + connect( mEnsureScreenHiddenTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(slotForcePaintBackground()) ); } // Only remove the mask widget once the resize is 100% complete! @@ -2127,7 +2131,7 @@ void LockProcess::doFunctionKeyBroadcast() { // This does NOT work with the SAK or system modal dialogs! if ((!trinity_desktop_lock_use_system_modal_dialogs) && (!trinity_desktop_lock_use_sak)) { mBusy=true; - TQTimer::singleShot(1000, this, TQT_SLOT(slotDeadTimePassed())); + TQTimer::singleShot(1000, this, TQ_SLOT(slotDeadTimePassed())); if (mkeyCode == XKeysymToKeycode(tqt_xdisplay(), XF86XK_Display)) { while (mDialogControlLock == true) { usleep(100000); @@ -2167,7 +2171,7 @@ bool LockProcess::x11Event(XEvent *event) (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_AudioRaiseVolume)) || \ (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_AudioLowerVolume))) { mkeyCode = event->xkey.keycode; - TQTimer::singleShot( 100, this, TQT_SLOT(doFunctionKeyBroadcast()) ); + TQTimer::singleShot( 100, this, TQ_SLOT(doFunctionKeyBroadcast()) ); return true; } // ACPI power keys @@ -2176,7 +2180,7 @@ bool LockProcess::x11Event(XEvent *event) (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_Suspend)) || \ (event->xkey.keycode == XKeysymToKeycode(event->xkey.display, XF86XK_Hibernate))) { mkeyCode = event->xkey.keycode; - TQTimer::singleShot( 100, this, TQT_SLOT(doFunctionKeyBroadcast()) ); + TQTimer::singleShot( 100, this, TQ_SLOT(doFunctionKeyBroadcast()) ); return true; } } @@ -2192,7 +2196,7 @@ bool LockProcess::x11Event(XEvent *event) // fall through case KeyPress: if ((mHackDelayStartupTimer) && (mHackDelayStartupTimer->isActive())) { - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } if (mBusy || !mDialogs.isEmpty()) { break; @@ -2202,12 +2206,12 @@ bool LockProcess::x11Event(XEvent *event) if (mLocked) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY if (mHackStartupEnabled) { - mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } } - if ((!mLocked) && (!mInSecureDialog)) { + if (!mLocked && !mInSecureDialog) { stopSaver(); - kapp->quit(); + tdeApp->quit(); } if (mAutoLogout) { // we need to restart the auto logout countdown @@ -2219,7 +2223,7 @@ bool LockProcess::x11Event(XEvent *event) if (!mLocked || checkPass()) { mClosingWindows = true; stopSaver(); - kapp->quit(); + tdeApp->quit(); } else if (mAutoLogout) { // we need to restart the auto logout countdown @@ -2251,7 +2255,7 @@ bool LockProcess::x11Event(XEvent *event) else { if (trinity_desktop_lock_use_system_modal_dialogs == true) { ENABLE_CONTINUOUS_LOCKDLG_DISPLAY - if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE); + if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, true); } else { resume( false ); @@ -2308,7 +2312,7 @@ bool LockProcess::x11Event(XEvent *event) && event->xkey.window != mDialogs.first()->winId()) { XEvent ev2 = *event; ev2.xkey.window = ev2.xkey.subwindow = mDialogs.first()->winId(); - tqApp->x11ProcessEvent( &ev2 ); + tdeApp->x11ProcessEvent( &ev2 ); return true; } @@ -2442,7 +2446,7 @@ void LockProcess::msgBox( TQMessageBox::Icon type, const TQString &txt ) KPushButton *button = new KPushButton( KStdGuiItem::ok(), winFrame ); button->setDefault( true ); button->setSizePolicy( TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ) ); - connect( button, TQT_SIGNAL( clicked() ), &box, TQT_SLOT( accept() ) ); + connect( button, TQ_SIGNAL( clicked() ), &box, TQ_SLOT( accept() ) ); TQVBoxLayout *vbox = new TQVBoxLayout( &box ); vbox->addWidget( winFrame ); @@ -2464,7 +2468,7 @@ void LockProcess::showVkbd() mVkbdWindows.clear(); mVkbdLastEventWindow = None; mKWinModule = new KWinModule( NULL, KWinModule::INFO_WINDOWS ); - connect( mKWinModule, TQT_SIGNAL( windowAdded( WId )), TQT_SLOT( windowAdded( WId ))); + connect( mKWinModule, TQ_SIGNAL( windowAdded( WId )), TQ_SLOT( windowAdded( WId ))); mVkbdProcess = new TDEProcess; *mVkbdProcess << "xvkbd" << "-compact" << "-geometry" << "-0-0" << "-xdm"; mVkbdProcess->start(); @@ -2678,7 +2682,7 @@ void LockProcess::slotMouseActivity(XEvent *event) } // Clicked inside dialog; set focus - if (inFrame == TRUE) { + if (inFrame) { WId window = mDialogs.first()->winId(); XSetInputFocus(tqt_xdisplay(), window, RevertToParent, CurrentTime); fakeFocusIn(window); @@ -2688,7 +2692,7 @@ void LockProcess::slotMouseActivity(XEvent *event) } // Clicked inside window handle (or border); drag window - if ((inFrame == TRUE) && (inDialog == FALSE)) { + if (inFrame && !inDialog) { TQPoint oldPoint = mDialogs.first()->pos(); m_mouseDown = 1; m_dialogPrevX = oldPoint.x(); @@ -2701,7 +2705,7 @@ void LockProcess::slotMouseActivity(XEvent *event) // Drag the window... if (event->type == MotionNotify) { - if (m_mouseDown == TRUE) { + if (m_mouseDown) { int deltaX = me->x_root - m_mousePrevX; int deltaY = me->y_root - m_mousePrevY; m_dialogPrevX = m_dialogPrevX + deltaX; @@ -2849,11 +2853,11 @@ void LockProcess::cryptographicCardInserted(TDECryptographicCardDevice* cdevice) m_loginCardDevice = cdevice; if (dynamic_cast<SAKDlg*>(currentDialog)) { dynamic_cast<SAKDlg*>(currentDialog)->closeDialogForced(); - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardLogin())); } else if (dynamic_cast<SecureDlg*>(currentDialog)) { dynamic_cast<SecureDlg*>(currentDialog)->closeDialogForced(); - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardLogin())); } else if (dynamic_cast<PasswordDlg*>(currentDialog)) { signalPassDlgToAttemptCardLogin(); @@ -2871,7 +2875,7 @@ void LockProcess::cryptographicCardRemoved(TDECryptographicCardDevice* cdevice) } else { m_loginCardDevice = NULL; - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardAbort())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardAbort())); } #endif } @@ -2886,7 +2890,7 @@ void LockProcess::signalPassDlgToAttemptCardLogin() else { if (currentDialog && m_loginCardDevice) { // Try again later - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardLogin())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardLogin())); } } #endif @@ -2902,7 +2906,7 @@ void LockProcess::signalPassDlgToAttemptCardAbort() else { if (currentDialog) { // Try again later - TQTimer::singleShot(0, this, SLOT(signalPassDlgToAttemptCardAbort())); + TQTimer::singleShot(0, this, TQ_SLOT(signalPassDlgToAttemptCardAbort())); } } #endif @@ -2963,7 +2967,7 @@ void LockProcess::saverReady() { // Control pipe handler // ControlPipeHandlerObject::ControlPipeHandlerObject() : TQObject() { - mParent = NULL; + mParent = nullptr; mRunning = false; mTerminate = false; mThreadID = 0L; @@ -2987,7 +2991,7 @@ void ControlPipeHandlerObject::run(void) { int display_number = atoi(TQString(XDisplayString(tqt_xdisplay())).replace(":","").ascii()); if (display_number < 0) { - printf("[kdesktop_lock] Warning: unable to create control socket. Interactive logon modules may not function properly.\n"); + printf("[kdesktop_lock] Warning: unable to create control socket. Interactive logon modules may not function properly.\n"); mRunning = false; TQApplication::eventLoop()->exit(-1); return; @@ -3018,7 +3022,7 @@ void ControlPipeHandlerObject::run(void) { } if (!mParent->mPipeOpen) { - printf("[kdesktop_lock] Warning: unable to create control socket '%s'. Interactive logon modules may not function properly.\n", fifo_file); + printf("[kdesktop_lock] Warning: unable to create control socket '%s'. Interactive logon modules may not function properly.\n", fifo_file); mRunning = false; TQApplication::eventLoop()->exit(-1); return; |