diff options
author | Emanoil Kotsev <deloptes@gmail.com> | 2024-12-18 14:35:13 +0000 |
---|---|---|
committer | Emanoil Kotsev <deloptes@gmail.com> | 2024-12-18 14:35:13 +0000 |
commit | 43b7fd601d4cd700e7e39e776b6e64528a9aea97 (patch) | |
tree | 33dc1be0320387bb1fb608f36e865a7a1b80b4a5 /kdesktop/dbus/screensaver | |
parent | 790f526f18e7917e4c066112215e02e94fd628ac (diff) | |
download | tdebase-43b7fd601d4cd700e7e39e776b6e64528a9aea97.tar.gz tdebase-43b7fd601d4cd700e7e39e776b6e64528a9aea97.zip |
DBus ScreenSaverfeat/dbusscreensaver
Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
Diffstat (limited to 'kdesktop/dbus/screensaver')
-rw-r--r-- | kdesktop/dbus/screensaver/CMakeLists.txt | 38 | ||||
-rw-r--r-- | kdesktop/dbus/screensaver/dbusscreensaverservice.cpp | 29 | ||||
-rw-r--r-- | kdesktop/dbus/screensaver/dbusscreensaverservice.h | 19 | ||||
-rw-r--r-- | kdesktop/dbus/screensaver/screensaverInterfaceImpl.cpp | 42 | ||||
-rw-r--r-- | kdesktop/dbus/screensaver/screensaverInterfaceImpl.h | 72 |
5 files changed, 74 insertions, 126 deletions
diff --git a/kdesktop/dbus/screensaver/CMakeLists.txt b/kdesktop/dbus/screensaver/CMakeLists.txt new file mode 100644 index 000000000..aa6d61a60 --- /dev/null +++ b/kdesktop/dbus/screensaver/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (C) 2024 Emanoil Kotsev +# deloptes (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR}/kdesktop + ${TQT_INCLUDE_DIRS} + ${TDE_INCLUDE_DIR} + ${DBUS_TQT_INCLUDE_DIRS} +) + + +##### headers ################################### + +install( FILES dbusscreensaverservice.h screensaverInterfaceImpl.h + DESTINATION ${INCLUDE_INSTALL_DIR}/kdesktop/dbus +) + +##### dbusscreensaverservice #################### + +set( target dbusscreensaverservice ) + +set( ${target}_SRCS + dbusscreensaverservice.cpp screensaverInterfaceImpl.cpp +) + +tde_add_library( ${target} STATIC_PIC AUTOMOC + SOURCES ${${target}_SRCS} + LINK ${DBUS_TQT_LIBRARIES} +) diff --git a/kdesktop/dbus/screensaver/dbusscreensaverservice.cpp b/kdesktop/dbus/screensaver/dbusscreensaverservice.cpp index ba19a970a..651890d87 100644 --- a/kdesktop/dbus/screensaver/dbusscreensaverservice.cpp +++ b/kdesktop/dbus/screensaver/dbusscreensaverservice.cpp @@ -57,18 +57,18 @@ TQT_DBusObjectBase* OrgNodeService::createInterface(const TQString& interfaceNam return (TQT_DBusObjectBase*) m_interfaces[interfaceName]; } -FreeDekstopNodeService::FreeDekstopNodeService(TQT_DBusConnection &connection) : +FreeDesktopNodeService::FreeDesktopNodeService(TQT_DBusConnection &connection) : DBusBaseNode(), m_connection(connection) { addChildNode("ScreenSaver"); registerObject(m_connection, "/org/freedesktop"); } -FreeDekstopNodeService::~FreeDekstopNodeService() +FreeDesktopNodeService::~FreeDesktopNodeService() { } -TQT_DBusObjectBase* FreeDekstopNodeService::createInterface(const TQString& interfaceName) +TQT_DBusObjectBase* FreeDesktopNodeService::createInterface(const TQString& interfaceName) { return (TQT_DBusObjectBase*) m_interfaces[interfaceName]; } @@ -85,14 +85,11 @@ ScreenSaverService::ScreenSaverService(TQT_DBusConnection &conn) : ScreenSaverService::~ScreenSaverService() { - stopService(); if(screenSaverInterface) + { + screenSaverInterface->restoreState(); delete screenSaverInterface; -} - -void ScreenSaverService::stopService() -{ - screenSaverInterface->restoreState(); + } } TQT_DBusObjectBase* ScreenSaverService::createInterface(const TQString& interfaceName) @@ -120,7 +117,7 @@ TDEDbusScreenSaver::~TDEDbusScreenSaver() } delete screenSaverService; - delete freeDekstopNodeService; + delete freeDesktopNodeService; delete orgService; delete rootService; } @@ -151,19 +148,19 @@ bool TDEDbusScreenSaver::configureService() rootService = new RootNodeService(m_connection); orgService = new OrgNodeService(m_connection); - freeDekstopNodeService = new FreeDekstopNodeService(m_connection); + freeDesktopNodeService = new FreeDesktopNodeService(m_connection); screenSaverService = new ScreenSaverService(m_connection); return true; } bool TDEDbusScreenSaver::unconfigureService() { - screenSaverService->stopService(); // will restore the original state + screenSaverService->screenSaverInterface->restoreState(); // will restore the original state - screenSaverService=0; - freeDekstopNodeService=0; - orgService=0; - rootService=0; + screenSaverService=nullptr; + freeDesktopNodeService=nullptr; + orgService=nullptr; + rootService=nullptr; // close D-Bus connection m_connection.closeConnection(DBUS_SCREENSAVER_SERVICE); diff --git a/kdesktop/dbus/screensaver/dbusscreensaverservice.h b/kdesktop/dbus/screensaver/dbusscreensaverservice.h index d556f201d..03713a4b1 100644 --- a/kdesktop/dbus/screensaver/dbusscreensaverservice.h +++ b/kdesktop/dbus/screensaver/dbusscreensaverservice.h @@ -22,27 +22,28 @@ #ifndef KDESKTOP_LOCK_DBUS_SCREENSAVER_DBUSSCREENSAVERSERVICE_H_ #define KDESKTOP_LOCK_DBUS_SCREENSAVER_DBUSSCREENSAVERSERVICE_H_ -#include <tqdbusconnection.h> #include <tqmap.h> +#include <tqdbusconnection.h> -#include "dbus/screensaver/screensaverNode.h" -#include "dbus/screensaver/dbusbaseNode.h" +#include "dbus/interfaces/screensaverNode.h" +#include "dbus/interfaces/dbusbaseNode.h" #include "screensaverInterfaceImpl.h" class ScreenSaverService: public org::freedesktop::screensaverNode { + friend class TDEDbusScreenSaver; + public: ScreenSaverService(TQT_DBusConnection&); virtual ~ScreenSaverService(); - void stopService(); protected: virtual TQT_DBusObjectBase* createInterface(const TQString&); + ScreenSaverInterfaceImpl *screenSaverInterface; private: TQMap<TQString, TQT_DBusObjectBase*> m_interfaces; TQT_DBusConnection m_connection; - ScreenSaverInterfaceImpl *screenSaverInterface; }; class RootNodeService: public DBusBaseNode @@ -69,11 +70,11 @@ private: TQT_DBusConnection m_connection; }; -class FreeDekstopNodeService: public DBusBaseNode +class FreeDesktopNodeService: public DBusBaseNode { public: - FreeDekstopNodeService(TQT_DBusConnection&); - virtual ~FreeDekstopNodeService(); + FreeDesktopNodeService(TQT_DBusConnection&); + virtual ~FreeDesktopNodeService(); protected: virtual TQT_DBusObjectBase* createInterface(const TQString&); private: @@ -118,7 +119,7 @@ private: RootNodeService *rootService; OrgNodeService *orgService; - FreeDekstopNodeService *freeDekstopNodeService; + FreeDesktopNodeService *freeDesktopNodeService; ScreenSaverService *screenSaverService; }; diff --git a/kdesktop/dbus/screensaver/screensaverInterfaceImpl.cpp b/kdesktop/dbus/screensaver/screensaverInterfaceImpl.cpp index 4f05a8391..4c3b8155c 100644 --- a/kdesktop/dbus/screensaver/screensaverInterfaceImpl.cpp +++ b/kdesktop/dbus/screensaver/screensaverInterfaceImpl.cpp @@ -75,28 +75,18 @@ bool ScreenSaverInterfaceImpl::Lock(TQT_DBusError& dbuserror) { return true; } -bool ScreenSaverInterfaceImpl::SimulateUserActivity(TQT_DBusError& dbuserror) { - tqDebug("SimulateUserActivity not implemented"); - return true; -} - -bool ScreenSaverInterfaceImpl::GetActive(bool& arg0, TQT_DBusError& dbuserror) { - tqDebug("GetActive not implemented"); - return true; -} - -bool ScreenSaverInterfaceImpl::GetActiveTime(TQ_UINT32& seconds, TQT_DBusError& dbuserror) { - tqDebug("GetActiveTime not implemented"); - return true; -} - -bool ScreenSaverInterfaceImpl::GetSessionIdleTime(TQ_UINT32& seconds, TQT_DBusError& dbuserror) { - tqDebug("GetSessionIdleTime not implemented"); - return true; -} - bool ScreenSaverInterfaceImpl::SetActive(bool& arg0, bool e, TQT_DBusError& dbuserror) { - tqDebug("SetActive not implemented"); + + DCOPReply reply = m_kdesktopdcoprefobj.call("setBlankOnly",e); + if (!reply.isValid()) + { + arg0 = false; + TQString err("ScreenSaverInterfaceImpl::Lock: there was some error using DCOP."); + tqDebug(err); + dbuserror = TQT_DBusError::stdFailed(err); + return false; + } + arg0 = true; return true; } @@ -144,16 +134,6 @@ bool ScreenSaverInterfaceImpl::UnInhibit(TQ_UINT32 cookie, TQT_DBusError& dbuser return true; } -bool ScreenSaverInterfaceImpl::Throttle(const TQString& application_name, const TQString& reason_for_inhibit, TQ_UINT32& cookie, TQT_DBusError& dbuserror) { - tqDebug("Throttle not implemented"); - return true; -} - -bool ScreenSaverInterfaceImpl::UnThrottle(TQ_UINT32 cookie, TQT_DBusError& dbuserror) { - tqDebug("UnThrottle not implemented"); - return true; -} - bool ScreenSaverInterfaceImpl::screenSaverIsEnabled() { DCOPReply reply = m_kdesktopdcoprefobj.call("isEnabled"); diff --git a/kdesktop/dbus/screensaver/screensaverInterfaceImpl.h b/kdesktop/dbus/screensaver/screensaverInterfaceImpl.h index 0b79f1693..03f85712a 100644 --- a/kdesktop/dbus/screensaver/screensaverInterfaceImpl.h +++ b/kdesktop/dbus/screensaver/screensaverInterfaceImpl.h @@ -27,7 +27,7 @@ #include <tqmap.h> #include <tqdbusconnection.h> -#include "dbus/screensaver/screensaverInterface.h" +#include "dbus/interfaces/screensaverInterface.h" #define DBUS_SCREENSAVER_SERVICE "TDEDbusScreenSaver" #define DBUS_SCREENSAVER_SERVICE_NAME "org.freedesktop.ScreenSaver" @@ -54,6 +54,7 @@ public: void restoreState(); protected: + /** * void Lock() * This method gets called when the service daemon @@ -62,51 +63,6 @@ protected: virtual bool Lock(TQT_DBusError& error); /** - * Name: SimulateUserActivity - * Args: (none) - * Returns: (nothing) - * Description: Simulate use activity to prevent screen saver being spawned - * - * Not implemented - */ - virtual bool SimulateUserActivity(TQT_DBusError& error); - - /** - * Name: GetActive - * Args: (none) - * Returns: DBUS_TYPE_BOOLEAN - * Descriptions: Returns the value of the current state of activity. - * See setActive(). - * - * Not implemented - */ - virtual bool GetActive(bool& arg0, TQT_DBusError& error); - - /** - * Name: GetActiveTime - * Args: (none) - * Returns: DBUS_TYPE_UINT32 - * Descriptions: Returns the number of seconds that the screensaver has - * been active. Returns zero if the screensaver is not - * active. - * - * Not implemented - */ - virtual bool GetActiveTime(TQ_UINT32& seconds, TQT_DBusError& error); - - /** - * - * Name: GetSessionIdleTime - * Args: (none) - * Returns: DBUS_TYPE_UINT32 - * Descriptions: Returns the number of seconds that the session has - * been idle. Returns zero if the session is not idle. - * - * Not implemented - */ - virtual bool GetSessionIdleTime(TQ_UINT32& seconds, TQT_DBusError& error); - - /** * Name: SetActive * Args: DBUS_TYPE_BOOLEAN state * state: TRUE to request activation, @@ -156,30 +112,6 @@ protected: */ virtual bool UnInhibit(TQ_UINT32 cookie, TQT_DBusError& error); - /** - * - * Name: Throttle - * Args: DBUS_TYPE_STRING "application-name" - * DBUS_TYPE_STRING "reason for throttle" - * INT cookie - * This is a random number used to identify the request. - * Description: Request that running themes while the screensaver is - * active be blocked until UnThrottle is called or the - * calling process exits. - * - * Not implemented - */ - virtual bool Throttle(const TQString& application_name, const TQString& reason_for_inhibit, TQ_UINT32& cookie, TQT_DBusError& error); - - /** - * Name: UnThrottle - * Args: DBUS_TYPE_UINT32 cookie - * Returns: (nothing) - * Description: Cancel a previous call to Throttle() identified by the cookie. - * Not implemented - */ - virtual bool UnThrottle(TQ_UINT32 cookie, TQT_DBusError& error); - virtual void handleMethodReply(const TQT_DBusMessage& reply); virtual bool handleSignalSend(const TQT_DBusMessage& reply); virtual TQString objectPath() const; |