File: atspi2-shutdown

package info (click to toggle)
brltty 5.6-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 25,116 kB
  • sloc: ansic: 117,871; sh: 6,590; java: 4,785; xml: 3,451; makefile: 1,973; tcl: 1,499; awk: 611; ml: 293; python: 250; lisp: 52
file content (29 lines) | stat: -rw-r--r-- 1,211 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
https://github.com/brltty/brltty/pull/137

commit fba63ebd4efef71b9059ff1afa157dabe5a897d5
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Thu Jun 28 01:20:58 2018 +0200

    atspi2: shutdown brltty automatically on session shutdown

diff --git a/Drivers/Screen/AtSpi2/screen.c b/Drivers/Screen/AtSpi2/screen.c
index e9d770057..39dddc015 100644
--- a/Drivers/Screen/AtSpi2/screen.c
+++ b/Drivers/Screen/AtSpi2/screen.c
@@ -1001,6 +1001,16 @@ static DBusHandlerResult AtSpi2Filter(DBusConnection *connection, DBusMessage *m
   if (type == DBUS_MESSAGE_TYPE_SIGNAL) {
     if (!strncmp(interface, SPI2_DBUS_INTERFACE_EVENT".", strlen(SPI2_DBUS_INTERFACE_EVENT"."))) {
       AtSpi2HandleEvent(interface + strlen(SPI2_DBUS_INTERFACE_EVENT"."), message);
+    } else if (!strcmp(interface, DBUS_INTERFACE_LOCAL) &&
+               !strcmp(member, "Disconnected")) {
+      logMessage(LOG_CATEGORY(SCREEN_DRIVER),
+                 "DBus disconnected signal, shutting down");
+#ifdef SIGTERM
+      raise(SIGTERM);
+#endif
+#ifdef SIGINT
+      raise(SIGINT);
+#endif
     } else {
       logMessage(LOG_CATEGORY(SCREEN_DRIVER),
                  "unknown signal: Intf:%s Msg:%s", interface, member);