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 | |
parent | 790f526f18e7917e4c066112215e02e94fd628ac (diff) | |
download | tdebase-feat/dbusscreensaver.tar.gz tdebase-feat/dbusscreensaver.zip |
DBus ScreenSaverfeat/dbusscreensaver
Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
-rw-r--r-- | ConfigureChecks.cmake | 2 | ||||
-rw-r--r-- | kdesktop/CMakeLists.txt | 11 | ||||
-rw-r--r-- | kdesktop/ConfigureChecks.cmake | 3 | ||||
-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 |
10 files changed, 91 insertions, 141 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 1bed63101..cff030238 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -464,6 +464,8 @@ if( BUILD_KDESKTOP ) if( NOT DBUS_1_TQT_FOUND ) tde_message_fatal( "dbus-1-tqt is required, but was not found on your system" ) endif( ) + + tde_setup_dbus( dbus-1-tqt ) endif( ) diff --git a/kdesktop/CMakeLists.txt b/kdesktop/CMakeLists.txt index 041e47355..9ee23c602 100644 --- a/kdesktop/CMakeLists.txt +++ b/kdesktop/CMakeLists.txt @@ -17,6 +17,7 @@ add_subdirectory( patterns ) add_subdirectory( programs ) add_subdirectory( init ) add_subdirectory( kwebdesktop ) +add_subdirectory( dbus/interfaces ) add_subdirectory( dbus/screensaver ) @@ -46,9 +47,10 @@ link_directories( ##### headers ################################### -install( FILES - KDesktopIface.h KScreensaverIface.h KBackgroundIface.h - DESTINATION ${INCLUDE_INSTALL_DIR} ) +install( + FILES KDesktopIface.h KScreensaverIface.h KBackgroundIface.h + DESTINATION ${INCLUDE_INSTALL_DIR} +) ##### other data ################################ @@ -91,7 +93,6 @@ set( ${target}_SRCS pixmapserver.cpp kcustommenu.cpp startupid.cpp minicli_ui.ui xautolock_diy.c xautolock_engine.c kshadowengine.cpp kshadowsettings.cpp kdesktopshadowsettings.cpp - dbusscreensaverservice.cpp screensaverInterfaceImpl.cpp tdefileividesktop.cpp kdesktopapp.cpp ) @@ -99,7 +100,7 @@ tde_add_tdeinit_executable( ${target} AUTOMOC SOURCES ${${target}_SRCS} LINK pthread kdesktopsettings-static bgnd-static dmctl-static - screensaverinterfaces-static + dbusscreensaverservice-static dbusscreensaveriface-static konq-shared tdeutils-shared tdesu-shared ${TDEHW_LIBRARIES} ${XRENDER_LIBRARIES} ${XCURSOR_LIBRARIES} Xext ${DL_LIBRARIES} ${XSS_LIBRARIES} ${DBUS_1_TQT_LIBRARIES} diff --git a/kdesktop/ConfigureChecks.cmake b/kdesktop/ConfigureChecks.cmake index e012b1213..bc53ec698 100644 --- a/kdesktop/ConfigureChecks.cmake +++ b/kdesktop/ConfigureChecks.cmake @@ -12,6 +12,3 @@ if( WITH_PAM ) set( TDESCREENSAVER_PAM_SERVICE "kde" CACHE INTERNAL "" ) endif( ) - -# check for dbus -tde_setup_dbus( dbus-1-tqt ) 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; |