changeset 104337:709480950021

* net/dbus.el (dbus-init-bus): Declare. Apply it for the :system and :session buses.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 18 Aug 2009 15:12:01 +0000
parents 327754e5dff0
children 0ac0e5bde043
files lisp/net/dbus.el
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/dbus.el	Tue Aug 18 07:35:06 2009 +0000
+++ b/lisp/net/dbus.el	Tue Aug 18 15:12:01 2009 +0000
@@ -34,12 +34,22 @@
 ;; option "--without-dbus".  Declare used subroutines and variables.
 (declare-function dbus-call-method "dbusbind.c")
 (declare-function dbus-call-method-asynchronously "dbusbind.c")
+(declare-function dbus-init-bus "dbusbind.c")
 (declare-function dbus-method-return-internal "dbusbind.c")
 (declare-function dbus-method-error-internal "dbusbind.c")
 (declare-function dbus-register-signal "dbusbind.c")
 (defvar dbus-debug)
 (defvar dbus-registered-functions-table)
 
+;; Initialize :system and :session buses.  This adds their file
+;; descriptors to input_wait_mask, in order to detect incoming
+;; messages immediately.
+;; We must avoid to call the function twice for a bus, because the
+;; DBusWatch will be removed then.
+(when (and (featurep 'dbusbind) (not (featurep 'dbus)))
+  (dbus-init-bus :system)
+  (dbus-init-bus :session))
+
 ;; Pacify byte compiler.
 (eval-when-compile
   (require 'cl))