From 792645c23e5729c98e8854788e47b38f82ce8a31 Mon Sep 17 00:00:00 2001 From: liyuan Date: Mon, 22 Jan 2007 12:08:16 +0000 Subject: [PATCH] 2007-01-22 Li Yuan * cspi/bonobo/cspi-bonobo.c: (cspi_get_registry_ior), (cspi_init): Bug #393010. Use REGISTRY IOR XAtom to get registryd. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@879 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 6 ++++++ cspi/bonobo/cspi-bonobo.c | 42 +++++++++++++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6313a88..a3cbd0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-22 Li Yuan + + * cspi/bonobo/cspi-bonobo.c: + (cspi_get_registry_ior), (cspi_init): + Bug #393010. Use REGISTRY IOR XAtom to get registryd. + 2007-01-19 Li Yuan * atk-bridge/bridge.c: diff --git a/cspi/bonobo/cspi-bonobo.c b/cspi/bonobo/cspi-bonobo.c index d4029f9..13b1aa3 100644 --- a/cspi/bonobo/cspi-bonobo.c +++ b/cspi/bonobo/cspi-bonobo.c @@ -25,6 +25,8 @@ #include #include #include "../cspi-lowlevel.h" +#include +#include CORBA_Object cspi_dup_ref (CORBA_Object object) @@ -114,27 +116,53 @@ cspi_display_name (void) return canonical_display_name; } +static gchar * +cspi_get_registry_ior (void) +{ + Atom AT_SPI_IOR; + Atom actual_type; + int actual_format; + unsigned char *data = NULL; + unsigned long nitems; + unsigned long leftover; + static Display *display = NULL; + if (!display) + display = XOpenDisplay (cspi_display_name ()); + + AT_SPI_IOR = XInternAtom (display, "AT_SPI_IOR", False); + XGetWindowProperty(display, + XDefaultRootWindow (display), + AT_SPI_IOR, 0L, + (long)BUFSIZ, False, + (Atom) 31, &actual_type, &actual_format, + &nitems, &leftover, &data); + if (data == NULL) + g_warning ("AT_SPI_REGISTRY was not started at session startup."); + + return (gchar *) data; +} + CORBA_Object cspi_init (void) { char *obj_id; CORBA_Object registry; CORBA_Environment ev; + char *ior = NULL; if (!bonobo_init (0, NULL)) { g_error ("Could not initialize Bonobo"); } - obj_id = "OAFIID:Accessibility_Registry:1.0"; - CORBA_exception_init (&ev); - bonobo_activation_set_activation_env_value ("AT_SPI_DISPLAY", - cspi_display_name ()); - - registry = bonobo_activation_activate_from_id ( - obj_id, 0, NULL, &ev); + ior = (char *) cspi_get_registry_ior (); + if (ior != NULL) + { + registry = CORBA_ORB_string_to_object (bonobo_activation_orb_get (), + ior, &ev); + } if (ev._major != CORBA_NO_EXCEPTION) { -- 2.7.4