diff options
Diffstat (limited to 'kdesktop/dbus')
-rw-r--r-- | kdesktop/dbus/interfaces/CMakeLists.txt | 12 | ||||
-rw-r--r-- | kdesktop/dbus/interfaces/org.freedesktop.ScreenSaver.xml | 4 | ||||
-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 |
7 files changed, 83 insertions, 133 deletions
diff --git a/kdesktop/dbus/interfaces/CMakeLists.txt b/kdesktop/dbus/interfaces/CMakeLists.txt index 9fb887326..8e2d29c17 100644 --- a/kdesktop/dbus/interfaces/CMakeLists.txt +++ b/kdesktop/dbus/interfaces/CMakeLists.txt @@ -12,23 +12,21 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${TQT_INCLUDE_DIRS} + ${TDE_INCLUDE_DIR} ${DBUS_TQT_INCLUDE_DIRS} ) -set( INTROSPECTIONPATH ${CMAKE_SOURCE_DIR}/kdesktop/dbus/screensaver ) - set( ScreenSaver_HDRS dbusbaseNode.h introspectableInterface.h screensaverInterface.h screensaverNode.h screensaverProxy.h) set( ScreenSaver_SRCS dbusbaseNode.cpp introspectableInterface.cpp screensaverInterface.cpp screensaverNode.cpp screensaverProxy.cpp ) -##### ScreenSaver ######################### +##### DbusScreenSaver ######################### add_custom_command( OUTPUT ${ScreenSaver_HDRS} ${ScreenSaver_SRCS} - COMMAND ${DBUSXML2QT3_EXECUTABLE} ${INTROSPECTIONPATH}/org.freedesktop.ScreenSaver.xml 2>/dev/null - DEPENDS ${INTROSPECTIONPATH}/org.freedesktop.ScreenSaver.xml + COMMAND ${DBUSXML2QT3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/org.freedesktop.ScreenSaver.xml 2>/dev/null WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) -tde_add_library( screensaverinterfaces STATIC_PIC AUTOMOC +tde_add_library( dbusscreensaveriface STATIC_PIC AUTOMOC SOURCES ${ScreenSaver_SRCS} LINK ${DBUS_TQT_LIBRARIES} ) @@ -37,7 +35,7 @@ tde_add_library( screensaverinterfaces STATIC_PIC AUTOMOC install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DESTINATION ${INCLUDE_INSTALL_DIR} + DESTINATION ${INCLUDE_INSTALL_DIR}/kdesktop/dbus/interfaces/ USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE diff --git a/kdesktop/dbus/interfaces/org.freedesktop.ScreenSaver.xml b/kdesktop/dbus/interfaces/org.freedesktop.ScreenSaver.xml index 1f7b09b28..015655aa8 100644 --- a/kdesktop/dbus/interfaces/org.freedesktop.ScreenSaver.xml +++ b/kdesktop/dbus/interfaces/org.freedesktop.ScreenSaver.xml @@ -6,6 +6,7 @@ </signal> <method name="Lock"> </method> +<!-- keep for future use <method name="SimulateUserActivity"> </method> <method name="GetActive"> @@ -17,6 +18,7 @@ <method name="GetSessionIdleTime"> <arg name="seconds" type="u" direction="out"/> </method> + --> <method name="SetActive"> <arg type="b" direction="out"/> <arg name="e" type="b" direction="in"/> @@ -29,6 +31,7 @@ <method name="UnInhibit"> <arg name="cookie" type="u" direction="in"/> </method> +<!-- keep for future use <method name="Throttle"> <arg name="application_name" type="s" direction="in"/> <arg name="reason_for_inhibit" type="s" direction="in"/> @@ -37,5 +40,6 @@ <method name="UnThrottle"> <arg name="cookie" type="u" direction="in"/> </method> + --> </interface> </node>
\ No newline at end of file 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; |