This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository e16.

View the commit online.

commit d54702b07150568ef3916ad5b80aab8f1fcdc406
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Fri Mar 8 14:07:41 2024 +0100

    session: Optionally do logout/shutdown via dbus commands
---
 src/session.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/src/session.c b/src/session.c
index f97b3f7e..7a379b9b 100644
--- a/src/session.c
+++ b/src/session.c
@@ -31,6 +31,9 @@
 #include "snaps.h"
 #include "user.h"
 #include "xwin.h"
+#if USE_DBUS
+#include "edbus.h"
+#endif
 
 #ifdef USE_EXT_INIT_WIN
 static EX_Window new_init_win_ext = NoXID;
@@ -533,6 +536,31 @@ doSMExit(int mode, const char *params)
 #define LOGOUT_SUSPEND      5
 #define LOGOUT_HIBERNATE    6
 
+#if USE_DBUS
+static int
+_SessionExitDbus(int how)
+{
+    if (Mode.wm.window)
+        return -1;
+
+    switch (how)
+    {
+    default:
+    case LOGOUT_LOCK:
+    case LOGOUT_SUSPEND:
+    case LOGOUT_HIBERNATE:
+        return -1;
+
+    case LOGOUT_EXIT:
+        return DbusRequestLogout();
+
+    case LOGOUT_REBOOT:
+    case LOGOUT_HALT:
+        return DbusRequestShutdown();
+    }
+}
+#endif                          /* USE_DBUS */
+
 static void
 _SessionLogout(int how)
 {
@@ -552,6 +580,11 @@ _SessionLogout(int how)
 
 #endif                          /* USE_SM */
 
+#if USE_DBUS
+    if (_SessionExitDbus(how) == 0)
+        return;
+#endif
+
     switch (how)
     {
     default:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to