Index: bridge.c
===================================================================
RCS file: /cvs/gnome/at-spi/atk-bridge/bridge.c,v
retrieving revision 1.93
diff -u -r1.93 bridge.c
--- bridge.c	14 Jun 2006 15:22:44 -0000	1.93
+++ bridge.c	10 Jul 2006 18:53:52 -0000
@@ -28,6 +28,8 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
 #include <libbonobo.h>
 #include <orbit/orbit.h>
 #include <atk/atk.h>
@@ -327,10 +329,34 @@
     return canonical_display_name;
 }
 
+static gchar *
+spi_atk_bridge_get_registry_ior (void)
+{
+ 
+  Atom AT_SPI_IOR = XInternAtom (GDK_DISPLAY(), "AT_SPI_IOR", False); 
+  Atom actual_type;
+  int actual_format;
+  unsigned char *data = NULL;  
+  unsigned long nitems;
+  unsigned long leftover;
+  XGetWindowProperty(GDK_DISPLAY (), GDK_ROOT_WINDOW (), AT_SPI_IOR, 0L, 
+		     (long)BUFSIZ, False, 
+		     (Atom) 31, &actual_type, &actual_format,
+		     &nitems, &leftover, &data);
+  
+  if (data == NULL)
+    g_critical ("AT_SPI_REGISTRY ior was not set \n"
+		"at gnome-session startup.");
+  
+  return (gchar *) data;
+  
+}
+
 static Accessibility_Registry
 spi_atk_bridge_get_registry (void)
 {
   CORBA_Environment ev;
+  char *ior =  NULL;
 
   if (registry_died || (registry == CORBA_OBJECT_NIL)) {
 	  CORBA_exception_init (&ev);
@@ -343,9 +369,17 @@
             }
 	  bonobo_activation_set_activation_env_value ("AT_SPI_DISPLAY", spi_display_name ());
 
-	  registry = bonobo_activation_activate_from_id (
-		  "OAFIID:Accessibility_Registry:1.0", 0, NULL, &ev);
-	  
+	  ior = (char *) spi_atk_bridge_get_registry_ior ();
+	
+	  if (ior != NULL)
+	       registry = CORBA_ORB_string_to_object (bonobo_activation_orb_get (), 
+						      ior, &ev);
+	  else if (!strcmp (g_get_user_name (), "gdm")) 
+	       registry = bonobo_activation_activate_from_id ("OAFIID:Accessibility_Registry:1.0", 
+							      0, NULL, &ev);
+	  else
+	       g_critical ("IOR not set.");
+	  	       
 	  if (ev._major != CORBA_NO_EXCEPTION)
 	  {
 		  g_error ("Accessibility app error: exception during "
