From d88718ee027e329565d2d97c5cadde4aa1b83166 Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Sun, 9 Jun 2024 22:04:25 +0300 Subject: KSMServer: improve suspend code 1. Some code deduplication. Suspending is now handled via the public method `suspend(int)` which is DCOP-accessible and maps SuspendType values to corresponding TDEHWLib TDESystemPowerState values, and the internal method `suspendInternal(int)` which performs the chosen suspend and optionally locks the screen beforehand. 2. Options are now read from power-managerrc on startup and stored in memory to avoid reading the configuration file every time a suspend is requested. 3. SuspendType is now a member of KSMServer class (instead of KSMShutdownDlg) 4. A new DCOP-accessible method `suspendOptions()` returns a TQStringList of all available suspend options. Signed-off-by: Mavridis Philippe --- ksmserver/server.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'ksmserver/server.h') diff --git a/ksmserver/server.h b/ksmserver/server.h index fdf08cded..511013dc7 100644 --- a/ksmserver/server.h +++ b/ksmserver/server.h @@ -37,6 +37,17 @@ class KSMListener; class KSMConnection; class KSMClient; +namespace SuspendType { + enum SuspendType { + NotSpecified = 0, + Freeze, + Standby, // not implemented + Suspend, + Hibernate, + HybridSuspend + }; +}; + enum SMType { SM_ERROR, SM_WMCOMMAND, SM_WMSAVEYOURSELF }; struct SMData { @@ -103,6 +114,7 @@ public: public slots: void cleanUp(); + void reconfigure(); private slots: void newConnection( int socket ); @@ -172,6 +184,8 @@ private: TDEApplication::ShutdownMode sdmode, TQString bootOption = TQString::null ); + void suspendInternal(int state); + void performLegacySessionSave(); void storeLegacySession( TDEConfig* config ); void restoreLegacySession( TDEConfig* config ); @@ -186,12 +200,14 @@ private: void resumeStartupInternal(); // public dcop interface - void logout( int, int, int ); - virtual void logoutTimed( int, int, TQString ); + void logout(int, int, int); + virtual void logoutTimed(int, int, TQString); + bool suspend(int); + TQStringList suspendOptions(); TQStringList sessionList(); TQString currentSession(); void saveCurrentSession(); - void saveCurrentSessionAs( TQString ); + void saveCurrentSessionAs(TQString); TQWidget* startupNotifierIPDlg; TQWidget* shutdownNotifierIPDlg; @@ -240,6 +256,10 @@ private: TDEApplication::ShutdownType pendingShutdown_sdtype; TDEApplication::ShutdownMode pendingShutdown_sdmode; + bool m_disableSuspend; + bool m_disableHibernate; + bool m_lockOnResume; + // ksplash interface void upAndRunning( const TQString& msg ); void publishProgress( int progress, bool max = false ); -- cgit v1.2.1