emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src dbusbind.c


From: Michael Albinus
Subject: [Emacs-diffs] emacs/src dbusbind.c
Date: Sat, 15 Aug 2009 18:27:59 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       09/08/15 18:27:59

Modified files:
        src            : dbusbind.c 

Log message:
        * dbusbind.c (xd_get_dispatch_status, xd_pending_messages): New 
functions.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/dbusbind.c?cvsroot=emacs&r1=1.39&r2=1.40

Patches:
Index: dbusbind.c
===================================================================
RCS file: /sources/emacs/emacs/src/dbusbind.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- dbusbind.c  8 Jul 2009 12:58:57 -0000       1.39
+++ dbusbind.c  15 Aug 2009 18:27:58 -0000      1.40
@@ -1414,6 +1414,41 @@
   return Qt;
 }
 
+/* Check, whether there is pending input in the message queue of the
+   D-Bus BUS.  BUS is a Lisp symbol, either :system or :session.  */
+int
+xd_get_dispatch_status (bus)
+     Lisp_Object bus;
+{
+  DBusConnection *connection;
+
+  /* Open a connection to the bus.  */
+  connection = xd_initialize (bus);
+
+  /* Non blocking read of the next available message.  */
+  dbus_connection_read_write (connection, 0);
+
+  /* Return.  */
+  return
+    (dbus_connection_get_dispatch_status (connection)
+     == DBUS_DISPATCH_DATA_REMAINS)
+    ? TRUE : FALSE;
+}
+
+/* Check for queued incoming messages from the system and session buses.  */
+int
+xd_pending_messages ()
+{
+
+  /* Vdbus_registered_functions_table will be initialized as hash
+     table in dbus.el.  When this package isn't loaded yet, it doesn't
+     make sense to handle D-Bus messages.  */
+  return (HASH_TABLE_P (Vdbus_registered_functions_table)
+         ? ((xd_get_dispatch_status (QCdbus_system_bus)
+             || (xd_get_dispatch_status (QCdbus_session_bus))))
+         : FALSE);
+}
+
 /* Read queued incoming message of the D-Bus BUS.  BUS is a Lisp
    symbol, either :system or :session.  */
 static Lisp_Object




reply via email to

[Prev in Thread] Current Thread [Next in Thread]