diff options
| author | Michael Albinus | 2009-08-15 18:27:58 +0000 |
|---|---|---|
| committer | Michael Albinus | 2009-08-15 18:27:58 +0000 |
| commit | f573d5886c10d1312e77c6d7e8bee35b15840d85 (patch) | |
| tree | a7beec794bc33c0a3d4fb34b4bdd3db615712e6e | |
| parent | 17310faf6be67fd1ed79180d328783555d754f15 (diff) | |
| download | emacs-f573d5886c10d1312e77c6d7e8bee35b15840d85.tar.gz emacs-f573d5886c10d1312e77c6d7e8bee35b15840d85.zip | |
* dbusbind.c (xd_get_dispatch_status, xd_pending_messages): New functions.
| -rw-r--r-- | src/dbusbind.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c index 8100c754399..aa4efa7ca33 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -1414,6 +1414,41 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */) | |||
| 1414 | return Qt; | 1414 | return Qt; |
| 1415 | } | 1415 | } |
| 1416 | 1416 | ||
| 1417 | /* Check, whether there is pending input in the message queue of the | ||
| 1418 | D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */ | ||
| 1419 | int | ||
| 1420 | xd_get_dispatch_status (bus) | ||
| 1421 | Lisp_Object bus; | ||
| 1422 | { | ||
| 1423 | DBusConnection *connection; | ||
| 1424 | |||
| 1425 | /* Open a connection to the bus. */ | ||
| 1426 | connection = xd_initialize (bus); | ||
| 1427 | |||
| 1428 | /* Non blocking read of the next available message. */ | ||
| 1429 | dbus_connection_read_write (connection, 0); | ||
| 1430 | |||
| 1431 | /* Return. */ | ||
| 1432 | return | ||
| 1433 | (dbus_connection_get_dispatch_status (connection) | ||
| 1434 | == DBUS_DISPATCH_DATA_REMAINS) | ||
| 1435 | ? TRUE : FALSE; | ||
| 1436 | } | ||
| 1437 | |||
| 1438 | /* Check for queued incoming messages from the system and session buses. */ | ||
| 1439 | int | ||
| 1440 | xd_pending_messages () | ||
| 1441 | { | ||
| 1442 | |||
| 1443 | /* Vdbus_registered_functions_table will be initialized as hash | ||
| 1444 | table in dbus.el. When this package isn't loaded yet, it doesn't | ||
| 1445 | make sense to handle D-Bus messages. */ | ||
| 1446 | return (HASH_TABLE_P (Vdbus_registered_functions_table) | ||
| 1447 | ? ((xd_get_dispatch_status (QCdbus_system_bus) | ||
| 1448 | || (xd_get_dispatch_status (QCdbus_session_bus)))) | ||
| 1449 | : FALSE); | ||
| 1450 | } | ||
| 1451 | |||
| 1417 | /* Read queued incoming message of the D-Bus BUS. BUS is a Lisp | 1452 | /* Read queued incoming message of the D-Bus BUS. BUS is a Lisp |
| 1418 | symbol, either :system or :session. */ | 1453 | symbol, either :system or :session. */ |
| 1419 | static Lisp_Object | 1454 | static Lisp_Object |