diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dbus-launch-x11.c | 6 | ||||
-rw-r--r-- | tools/dbus-launch.c | 2 | ||||
-rw-r--r-- | tools/dbus-print-message.c | 3 | ||||
-rw-r--r-- | tools/dbus-send.c | 51 | ||||
-rwxr-xr-x | tools/run-with-tmp-session-bus.sh | 5 |
5 files changed, 56 insertions, 11 deletions
diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c index 442e9ba2..b1824181 100644 --- a/tools/dbus-launch-x11.c +++ b/tools/dbus-launch-x11.c @@ -361,9 +361,9 @@ set_address_in_x11(char *address, pid_t pid) } /* Create our window */ - wid = XCreateSimpleWindow (xdisplay, RootWindow (xdisplay, 0), -20, -20, 10, 10, - 0, WhitePixel (xdisplay, 0), - BlackPixel (xdisplay, 0)); + wid = XCreateWindow (xdisplay, RootWindow (xdisplay, 0), -20, -20, 10, 10, + 0, CopyFromParent, InputOnly, CopyFromParent, + 0, NULL); verbose ("Created window %d\n", wid); /* Save the property in the window */ diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 216f7435..139d0aaf 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -402,7 +402,9 @@ signal_handler (int sig) { switch (sig) { +#ifdef SIGHUP case SIGHUP: +#endif case SIGTERM: got_sighup = TRUE; break; diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c index d5fced34..ea15769f 100644 --- a/tools/dbus-print-message.c +++ b/tools/dbus-print-message.c @@ -263,7 +263,8 @@ print_message (DBusMessage *message, dbus_bool_t literal) { case DBUS_MESSAGE_TYPE_METHOD_CALL: case DBUS_MESSAGE_TYPE_SIGNAL: - printf (" path=%s; interface=%s; member=%s\n", + printf (" serial=%u path=%s; interface=%s; member=%s\n", + dbus_message_get_serial (message), dbus_message_get_path (message), dbus_message_get_interface (message), dbus_message_get_member (message)); diff --git a/tools/dbus-send.c b/tools/dbus-send.c index 407c0497..81a9c372 100644 --- a/tools/dbus-send.c +++ b/tools/dbus-send.c @@ -33,7 +33,7 @@ static const char *appname; static void usage (int ecode) { - fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=NAME] [--type=TYPE] [--print-reply=(literal)] [--reply-timeout=MSEC] <destination object path> <message name> [contents ...]\n", appname); + fprintf (stderr, "Usage: %s [--help] [--system | --session | --address=ADDRESS] [--dest=NAME] [--type=TYPE] [--print-reply=(literal)] [--reply-timeout=MSEC] <destination object path> <message name> [contents ...]\n", appname); exit (ecode); } @@ -222,6 +222,8 @@ main (int argc, char *argv[]) const char *path = NULL; int message_type = DBUS_MESSAGE_TYPE_SIGNAL; const char *type_str = NULL; + const char *address = NULL; + int session_or_system = FALSE; appname = argv[0]; @@ -237,9 +239,29 @@ main (int argc, char *argv[]) char *arg = argv[i]; if (strcmp (arg, "--system") == 0) - type = DBUS_BUS_SYSTEM; + { + type = DBUS_BUS_SYSTEM; + session_or_system = TRUE; + } else if (strcmp (arg, "--session") == 0) - type = DBUS_BUS_SESSION; + { + type = DBUS_BUS_SESSION; + session_or_system = TRUE; + } + else if (strstr (arg, "--address") == arg) + { + address = strchr (arg, '='); + + if (address == NULL) + { + fprintf (stderr, "\"--address=\" requires an ADDRESS\n"); + usage (1); + } + else + { + address = address + 1; + } + } else if (strncmp (arg, "--print-reply", 13) == 0) { print_reply = TRUE; @@ -271,6 +293,13 @@ main (int argc, char *argv[]) if (name == NULL) usage (1); + if (session_or_system && + (address != NULL)) + { + fprintf (stderr, "\"--address\" may not be used with \"--system\" or \"--session\"\n"); + usage (1); + } + if (type_str != NULL) { message_type = dbus_message_type_from_string (type_str); @@ -284,11 +313,21 @@ main (int argc, char *argv[]) } dbus_error_init (&error); - connection = dbus_bus_get (type, &error); + + if (address != NULL) + { + connection = dbus_connection_open (address, &error); + } + else + { + connection = dbus_bus_get (type, &error); + } + if (connection == NULL) { - fprintf (stderr, "Failed to open connection to %s message bus: %s\n", - (type == DBUS_BUS_SYSTEM) ? "system" : "session", + fprintf (stderr, "Failed to open connection to \"%s\" message bus: %s\n", + (address != NULL) ? address : + ((type == DBUS_BUS_SYSTEM) ? "system" : "session"), error.message); dbus_error_free (&error); exit (1); diff --git a/tools/run-with-tmp-session-bus.sh b/tools/run-with-tmp-session-bus.sh index f95ee62e..982184a2 100755 --- a/tools/run-with-tmp-session-bus.sh +++ b/tools/run-with-tmp-session-bus.sh @@ -26,8 +26,11 @@ SERVICE_DIR="$DBUS_TOP_BUILDDIR/test/data/valid-service-files" ESCAPED_SERVICE_DIR=`echo $SERVICE_DIR | sed -e 's/\//\\\\\\//g'` echo "escaped service dir is: $ESCAPED_SERVICE_DIR" >&2 +if test -z "$SOURCE_CONFIG_FILE"; then + SOURCE_CONFIG_FILE="$DBUS_TOP_BUILDDIR/bus/session.conf"; +fi ## create a configuration file based on the standard session.conf -cat $DBUS_TOP_BUILDDIR/bus/session.conf | \ +cat $SOURCE_CONFIG_FILE | \ sed -e 's/<standard_session_servicedirs.*$/<servicedir>'$ESCAPED_SERVICE_DIR'<\/servicedir>/g' | \ sed -e 's/<include.*$//g' \ > $CONFIG_FILE |