billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=87d653ea4d2718038e1094542072143cc9704a71

commit 87d653ea4d2718038e1094542072143cc9704a71
Author: Boris Faure <bill...@gmail.com>
Date:   Mon Jan 12 23:11:12 2015 +0100

    add xterm 777 notification support. Closes T1765
---
 src/bin/dbus.c       |  5 +++++
 src/bin/termptyesc.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/src/bin/dbus.c b/src/bin/dbus.c
index b7d255c..da24108 100644
--- a/src/bin/dbus.c
+++ b/src/bin/dbus.c
@@ -82,6 +82,11 @@ ty_dbus_init(void)
 
    eldbus_init();
 
+   if (!elm_need_sys_notify())
+     {
+        WRN("no elementary system notification support");
+     }
+
    ty_dbus_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
    ty_e_object = eldbus_object_get(ty_dbus_conn,
                                    "org.enlightenment.wm.service",
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 4cabcb5..58d2418 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -1140,6 +1140,49 @@ err:
 }
 
 
+static void
+_handle_xterm_777_command(Termpty *ty EINA_UNUSED,
+                          char *s, int len EINA_UNUSED)
+{
+#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR >= 8)
+   char *cmd_end = NULL,
+        *title = NULL,
+        *title_end = NULL,
+        *message = NULL;
+
+   if (strncmp(s, "notify;", strlen("notify;")))
+     {
+        ERR("unrecognized xterm 777 command %s", s);
+        return;
+     }
+
+   if (!elm_need_sys_notify())
+     {
+        ERR("no elementary system notification support");
+        return;
+     }
+   cmd_end = s + strlen("notify");
+   if (*cmd_end != ';')
+     return;
+   *cmd_end = '\0';
+   title = cmd_end + 1;
+   title_end = strchr(title, ';');
+   if (!title_end)
+     {
+        *cmd_end = ';';
+        return;
+     }
+   *title_end = '\0';
+   message = title_end + 1;
+
+   elm_sys_notify_send(0, "dialog-information", title, message,
+                       ELM_SYS_NOTIFY_URGENCY_NORMAL, -1,
+                       NULL, NULL);
+   *cmd_end = ';';
+   *title_end = ';';
+#endif
+}
+
 static int
 _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
 {
@@ -1306,6 +1349,15 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, 
Eina_Unicode *ce)
                 r, g, b, 0xff);
           }
         break;
+      case 777:
+        DBG("xterm notification support");
+        s = eina_unicode_unicode_to_utf8(p, &len);
+        if (s)
+          {
+             _handle_xterm_777_command(ty, s, len);
+             free(s);
+          }
+        break;
       default:
         // many others
         ERR("unhandled xterm esc %d", arg);

-- 


Reply via email to