- Atom AT_SPI_BUS;
- Atom actual_type;
- Display *bridge_display;
- int actual_format;
- unsigned char *data = NULL;
- unsigned long nitems;
- unsigned long leftover;
-
- DBusConnection *bus = NULL;
- DBusError error;
-
- bridge_display = XOpenDisplay (spi_display_name ());
- if (!bridge_display)
- g_error ("AT_SPI: Could not get the display\n");
-
- AT_SPI_BUS = XInternAtom (bridge_display, "AT_SPI_BUS", False);
- XGetWindowProperty(bridge_display,
- XDefaultRootWindow (bridge_display),
- AT_SPI_BUS, 0L,
- (long)BUFSIZ, False,
- (Atom) 31, &actual_type, &actual_format,
- &nitems, &leftover, &data);
-
- dbus_error_init (&error);
-
- if (data == NULL)
- {
- g_warning ("AT-SPI: Accessibility bus not found - Using session bus.\n");
- bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
- if (!bus)
- g_error ("AT-SPI: Couldn't connect to bus: %s\n", error.message);
- }
- else
- {
- bus = dbus_connection_open (data, &error);
- if (!bus)
- {
- g_error ("AT-SPI: Couldn't connect to bus: %s\n", error.message);
- }
- else
- {
- if (!dbus_bus_register (bus, &error))
- g_error ("AT-SPI: Couldn't register with bus: %s\n");
- }
- }
-
- return bus;
+ Atom AT_SPI_BUS;
+ Atom actual_type;
+ Display *bridge_display;
+ int actual_format;
+ unsigned char *data = NULL;
+ unsigned long nitems;
+ unsigned long leftover;
+
+ DBusConnection *bus = NULL;
+ DBusError error;
+
+ bridge_display = XOpenDisplay (spi_display_name ());
+ if (!bridge_display)
+ g_error ("AT_SPI: Could not get the display\n");
+
+ AT_SPI_BUS = XInternAtom (bridge_display, "AT_SPI_BUS", False);
+ XGetWindowProperty (bridge_display,
+ XDefaultRootWindow (bridge_display),
+ AT_SPI_BUS, 0L,
+ (long) BUFSIZ, False,
+ (Atom) 31, &actual_type, &actual_format,
+ &nitems, &leftover, &data);
+
+ dbus_error_init (&error);
+
+ if (data == NULL)
+ {
+ g_warning
+ ("AT-SPI: Accessibility bus not found - Using session bus.\n");
+ bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
+ if (!bus)
+ g_error ("AT-SPI: Couldn't connect to bus: %s\n", error.message);
+ }
+ else
+ {
+ bus = dbus_connection_open (data, &error);
+ if (!bus)
+ {
+ g_error ("AT-SPI: Couldn't connect to bus: %s\n", error.message);
+ }
+ else
+ {
+ if (!dbus_bus_register (bus, &error))
+ g_error ("AT-SPI: Couldn't register with bus: %s\n", error.message);
+ }
+ }
+
+ return bus;
+}
+
+static void
+set_reply (DBusPendingCall *pending, void *user_data)
+{
+ void **replyptr = (void **)user_data;
+
+ *replyptr = dbus_pending_call_steal_reply (pending);