-/*
- * Gets the IOR from the XDisplay.
- * Not currently used in D-Bus version, but something similar
- * may be employed in the future for accessing the registry daemon
- * bus name.
- */
-
-static DBusConnection *
-spi_atk_bridge_get_bus (void)
-{
- 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_warning ("AT_SPI: Could not get the display\n");
- return NULL;
- }
-
- 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_warning ("AT-SPI: Couldn't connect to bus: %s\n", error.message);
- return NULL;
- }
- }
- else
- {
- bus = dbus_connection_open (data, &error);
- if (!bus)
- {
- g_warning ("AT-SPI: Couldn't connect to bus: %s\n", error.message);
- return NULL;
- }
- else
- {
- if (!dbus_bus_register (bus, &error))
- {
- g_warning ("AT-SPI: Couldn't register with bus: %s\n", error.message);
- return NULL;
- }
- }
- }
-
- return bus;
-}
-