*** at-spi-858/ChangeLog	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/ChangeLog	2007-02-27 07:44:06.000000000 -0800
***************
*** 1,3 ****
--- 1,127 ----
+ 2007-01-22  Li Yuan  <li.yuan@sun.com>
+ 
+ 	* configure.in, NEWS: Uprev/release 1.7.16 for gnome 2.18.0 Beta 1.
+ 
+ 2007-01-22  Li Yuan  <li.yuan@sun.com>
+ 
+ 	* 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  <li.yuan@sun.com>
+ 
+ 	* atk-bridge/bridge.c:
+ 	(atk_bridge_init), (spi_atk_bridge_register_application),
+ 	(deregister_application), (spi_atk_bridge_focus_tracker),
+ 	(spi_atk_emit_eventv): 
+ 	Bug #329454. Use atk_misc_threads_enter/atk_misc_threads_leave
+ 	to prevent deadlock.
+ 
+ 2007-01-08  Li Yuan  <li.yuan@sun.com>
+ 
+ 	* configure.in, NEWS: Uprev/release 1.7.15 for gnome 2.17.5.
+ 
+ 2007-01-08  Li Yuan  <li.yuan@sun.com>
+ 
+ 	* registryd/registry-main.c:
+ 	(main): set registry ior only when register server successfully.
+ 	* atk-bridge/bridge.c:
+ 	(spi_atk_bridge_register_application), (spi_atk_emit_eventv):
+ 	Bug #372988, #381670. Fix memory leak.
+ 
+ 2007-01-02  Bill Haneman <billh@gnome.org>
+ 
+ 	* libspi/text.c:
+ 	(impl_getAttributeRun): Fix misuse of 'i' instead of 'j' when
+ 	appending default attributes to a text attribute set.
+ 	Bug #387960.
+ 
+ 2006-12-28  Li Yuan  <li.yuan@sun.com>
+ 
+ 	* atk-bridge/bridge.c:
+ 	(spi_atk_tidy_windows): init any again if call spi_atk_emit_eventv
+ 	the second time, because spi_atk_emit_eventv will free any. Bug
+ 	#364839.
+ 
+ 2006-12-15  Li Yuan  <li.yuan@sun.com>
+ 
+ 	* configure.in, NEWS: Uprev/release 1.7.14 for gnome 2.17.4.
+ 
+ 2006-12-14  Li Yuan  <li.yuan@sun.com>
+ 
+ 	Fix for #352444
+ 	* atk-bridge/bridge.c: (spi_atk_emit_eventv),
+ 	(spi_atk_bridge_property_event_listener),
+ 	(spi_atk_bridge_signal_listener):
+ 	Free some CORBA objects to fix memory leak and crash.
+ 
+ 2006-12-13  Li Yuan <li.yuan@sun.com>
+ 
+ 	Patch from Ariel Rios to fix #163132 and #377079.
+ 	* atk-bridge/bridge.c: (spi_atk_bridge_do_registration),
+ 	(spi_atk_bridge_get_registry_ior):
+ 	Use g_warning instead of g_error and g_critical to avoid crash.
+ 
+ 2006-12-11 Bill Haneman <bill.haneman@sun.com>
+ 
+ 	* libspi/text.c:
+ 	(impl_getAttributeRun):Return an empty CORBA_seq instead of NULL,
+ 	if there are no non-default attributes defined at the current offset.
+ 	Fixes bug #372172.
+ 
+ 2006-12-04  Bill Haneman <bill.haneman@sun.com>
+ 
+ 	* idl/Accessibility_Role.idl: Fixed the documentation for
+ 	ROLE_FORM; bug #382271.  Thanks to George Kraft for finding this.
+ 	
+ 2006-12-04  Bill Haneman <bill.haneman@sun.com>
+ 	
+ 	* Added Li Yuan <li.yuan@sun.com> to MAINTAINERS.
+ 
+ 2006-11-07  Bill Haneman <bill.haneman@sun.com>
+ 
+ 	Patches from Padraig O'Briain for bugs #361386 and #369377.
+ 	
+ 	* registryd/registry.c:
+ 	(struct NotifyContext): Change the e_out
+ 	member from an Accessibility_Event struct to a pointer to 
+ 	struct.
+ 	(notify_listeners_cb): Modify to use the new struct definition above.
+ 	Allows use of ORBit_copy_value instead of CORBA_any__copy.
+ 
+ 	* registryd/deviceeventcontroller.c:
+ 	(spi_dec_button_update_and_emit): Free the event's any_data
+ 	after emission.
+ 	(spi_dec_mouse_check):Free the event details any struct
+ 	after emission.
+ 	(spi_device_event_controller_forward_mouse_event): Free any.
+ 	(spi_device_event_controller_forward_key_event): Ditto.
+ 	
+ 2006-11-07  Bill Haneman <bill.haneman@sun.com>
+ 
+ 	* configure.in: Uprev/release 1.7.13 for gnome 2.17.2.
+ 	Don't require gtk+ and gail for building most of at-spi
+ 	including libspi.
+ 
+ 	* registryd/registry-main.c (main): We now get te value of display
+ 	using the env var DISPLAY rather than using the gdk_display_get_default
+ 	to avoid dependancy of gdk. Also, once the registry is started, we set 
+ 	the ior of the registry as an X property.
+ 	(registry_set_ior): Set ior as the AT_SPI_IOR Root window property.
+ 
+ 	* atk-bridge/bridge.c (atk_bridge_init): We keep track whether 
+ 	the registration was successfull.
+ 	(spi_atk_bridge_do_registration): This function now returns success 
+ 	or not on activating the registry. 
+ 	(spi_atk_bridge_get_registry_ior): Look whether the AT_SPI_IOR property
+ 	has been set in the X root window and return it if available.
+ 	(spi_atk_bridge_get_registry): We now get the registry using the IOR 
+ 	saved as  a X property rather than using the OAFID. 
+ 
+ 2006-10-01  Bill Haneman <bill.haneman@sun.com>
+ 
+ 	* configure.in: Uprev/release 1.7.12 for gnome 2.16.1.
+ 
  2006-09-25  Bill Haneman <bill.haneman@sun.com>
  
  	* registryd/registry.c:
*** at-spi-858/MAINTAINERS	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/MAINTAINERS	2007-02-27 07:44:06.000000000 -0800
***************
*** 1,3 ****
--- 1,4 ----
  Bill Haneman     <bill.haneman@sun.com>
+ Li Yuan          <li.yuan@sun.com>
  
  
*** at-spi-858/NEWS	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/NEWS	2007-02-27 07:44:06.000000000 -0800
***************
*** 1,3 ****
--- 1,28 ----
+ What's new in at-spi-1.7.16:
+ 
+ * Bugfixes: #329454, #393010.
+ 
+ What's new in at-spi-1.7.15:
+ 
+ * Bugfixes: #372988, #381670, #387960, #364839.
+ 
+ What's new in at-spi-1.7.14:
+ 
+ * We now get te value of display using the env var DISPLAY rather than
+   using the gdk_display_get_default to avoid dependancy of gdk. Also, 
+   once the registry is started, we set the ior of the registry as 
+   an X property.
+ 
+ * Bugfixes: #361386, #369377, #382271, #372172, #163132, #377079, #352444
+ 
+ What's new in at-spi-1.7.12:
+ 
+ * Modified parameter names in some IDL to avoid class name collisions
+   (Gary Cramblitt).  This is a bincompat change which improves portability
+   of the IDL.
+ 
+ * Bugfixes: #353226, #356688 (Neo Liu), #350552 (Ginn Chen), #350958.
+ 
  What's new in at-spi-1.7.11:
  
  * Docs fixes.
*** at-spi-858/atk-bridge/bridge.c	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/atk-bridge/bridge.c	2007-02-27 07:44:06.000000000 -0800
***************
*** 23,28 ****
--- 23,30 ----
  
  #include "config.h"
  
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
  #include <string.h>
  #include <stdio.h>
  #include <unistd.h>
***************
*** 53,58 ****
--- 55,61 ----
  static gboolean atk_listeners_registered = FALSE;
  static gint toplevels = 0;
  static gboolean exiting = FALSE;
+ static AtkMisc *misc = NULL;
  
  static guint atk_signal_text_changed;
  static guint atk_signal_children_changed;
***************
*** 72,78 ****
  static guint atk_signal_bounds_changed;
  
  static Accessibility_Registry spi_atk_bridge_get_registry (void);
! static void     spi_atk_bridge_do_registration         (void);
  static void     spi_atk_bridge_toplevel_added          (AtkObject             *object,
                                                          guint                 index,
                                                          AtkObject             *child);
--- 75,81 ----
  static guint atk_signal_bounds_changed;
  
  static Accessibility_Registry spi_atk_bridge_get_registry (void);
! static gboolean spi_atk_bridge_do_registration         (void);
  static void     spi_atk_bridge_toplevel_added          (AtkObject             *object,
                                                          guint                 index,
                                                          AtkObject             *child);
***************
*** 83,88 ****
--- 86,92 ----
  static void     spi_atk_bridge_exit_func               (void);
  static void     spi_atk_register_event_listeners       (void);
  static void     spi_atk_bridge_focus_tracker           (AtkObject             *object);
+ static gchar   *spi_atk_bridge_get_registry_ior        (void);
  static void     spi_atk_bridge_register_application    (Accessibility_Registry registry);
  static gboolean spi_atk_bridge_property_event_listener (GSignalInvocationHint *signal_hint,
  							guint                  n_param_values,
***************
*** 172,177 ****
--- 176,182 ----
  {
    const char *debug_env_string = g_getenv ("AT_SPI_DEBUG");
    gchar *fname;
+   gboolean success = FALSE;
  
    if (atk_bridge_initialized)
      {
***************
*** 180,185 ****
--- 185,192 ----
    atk_bridge_initialized = TRUE;
    atk_bridge_pid = getpid ();
  
+   misc = atk_misc_get_instance();
+ 
    if (g_getenv ("ATK_BRIDGE_REDIRECT_LOG"))
    {
        fname = g_strconcat ("/tmp/", g_get_prgname (), ".at-spi-log", NULL);
***************
*** 219,234 ****
      }
    else
      {
!       spi_atk_bridge_do_registration ();
      }
-   spi_atk_register_event_listeners ();
-   spi_atk_bridge_init_event_type_consts ();
-  
    return 0;
  }
  
  
! static void
  spi_atk_bridge_do_registration (void)
  {
    CORBA_Environment ev;
--- 226,247 ----
      }
    else
      {
!       success = spi_atk_bridge_do_registration ();
!     }
!   if (success) 
!     {
!       spi_atk_register_event_listeners ();
!       spi_atk_bridge_init_event_type_consts ();
!     }
!   else
!     {
!       atk_bridge_initialized = FALSE;
      }
    return 0;
  }
  
  
! static gboolean
  spi_atk_bridge_do_registration (void)
  {
    CORBA_Environment ev;
***************
*** 237,243 ****
  
    if (spi_atk_bridge_get_registry () == CORBA_OBJECT_NIL)
      {
!       g_error ("Could not locate registry");
      }
  
    bonobo_activate ();
--- 250,257 ----
  
    if (spi_atk_bridge_get_registry () == CORBA_OBJECT_NIL)
      {
!       g_warning ("Could not locate registry");
!       return FALSE;
      }
  
    bonobo_activate ();
***************
*** 253,259 ****
    g_atexit (spi_atk_bridge_exit_func);
  
    DBG (1, g_message ("Application registered & listening\n"));
! 
  }
  
  static void
--- 267,273 ----
    g_atexit (spi_atk_bridge_exit_func);
  
    DBG (1, g_message ("Application registered & listening\n"));
!   return TRUE;
  }
  
  static void
***************
*** 291,299 ****
--- 305,317 ----
  static void
  spi_atk_bridge_register_application (Accessibility_Registry registry)
  {
+   atk_misc_threads_leave (misc);
    Accessibility_Registry_registerApplication (spi_atk_bridge_get_registry (),
                                                BONOBO_OBJREF (this_app),
                                                &ev);
+   atk_misc_threads_enter (misc);
+   if (ev._major != CORBA_NO_EXCEPTION)
+     CORBA_exception_free (&ev);
  }
  
  /* 
***************
*** 332,341 ****
--- 350,390 ----
      return canonical_display_name;
  }
  
+ static     Display *bridge_display = NULL;
+ 
+ static gchar *
+ spi_atk_bridge_get_registry_ior (void)
+ {
+      
+      Atom AT_SPI_IOR;
+      Atom actual_type;
+      int actual_format;
+      unsigned char *data = NULL;  
+      unsigned long nitems;
+      unsigned long leftover;
+      if (!bridge_display) 
+        bridge_display = XOpenDisplay (spi_display_name ());
+ 
+      AT_SPI_IOR = XInternAtom (bridge_display, "AT_SPI_IOR", False); 
+      XGetWindowProperty(bridge_display, 
+ 			XDefaultRootWindow (bridge_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;
+      
+ }
+ 
+ 
  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);
***************
*** 346,355 ****
                else
  	        DBG (1, g_warning ("registry died! restarting..."));
              }
- 	  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);
  	  
  	  if (ev._major != CORBA_NO_EXCEPTION)
  	  {
--- 395,411 ----
                else
  	        DBG (1, g_warning ("registry died! restarting..."));
              }
  
! 	  /* XXX: This presumes that the registry has successfully restarted itself already...*/
! 	  ior = (char *) spi_atk_bridge_get_registry_ior ();
! 
! 	  if (ior != NULL)
! 	       registry = CORBA_ORB_string_to_object (bonobo_activation_orb_get (), 
! 						      ior, &ev);
! 	  else {
! 	       g_warning ("IOR not set.");  
! 	       registry = CORBA_OBJECT_NIL;
! 	  }
  	  
  	  if (ev._major != CORBA_NO_EXCEPTION)
  	  {
***************
*** 503,510 ****
  static void
  deregister_application (BonoboObject *app)
  {
!   Accessibility_Registry registry = spi_atk_bridge_get_registry ();	
    Accessibility_Registry_deregisterApplication (registry, BONOBO_OBJREF (app), &ev);
  
    device_event_controller = bonobo_object_release_unref (device_event_controller, &ev);
    registry = bonobo_object_release_unref (registry, &ev);
--- 559,568 ----
  static void
  deregister_application (BonoboObject *app)
  {
!   Accessibility_Registry registry = spi_atk_bridge_get_registry ();
!   atk_misc_threads_leave (misc);
    Accessibility_Registry_deregisterApplication (registry, BONOBO_OBJREF (app), &ev);
+   atk_misc_threads_enter (misc);
  
    device_event_controller = bonobo_object_release_unref (device_event_controller, &ev);
    registry = bonobo_object_release_unref (registry, &ev);
***************
*** 555,560 ****
--- 613,620 ----
      {
        g_assert (!bonobo_debug_shutdown ());
      }
+   if (bridge_display)
+     XCloseDisplay (bridge_display);
  }
  
  void
***************
*** 588,601 ****
      }
  
    listener_ids = NULL;
!   atk_remove_focus_tracker (atk_bridge_focus_tracker_id);
    
    for (i = 0; ids && i < ids->len; i++)
    {
            atk_remove_global_event_listener (g_array_index (ids, guint, i));
    }
    
!   atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
  
    deregister_application (app);
  }
--- 648,663 ----
      }
  
    listener_ids = NULL;
!   if (atk_bridge_focus_tracker_id)
!         atk_remove_focus_tracker (atk_bridge_focus_tracker_id);
    
    for (i = 0; ids && i < ids->len; i++)
    {
            atk_remove_global_event_listener (g_array_index (ids, guint, i));
    }
    
!   if (atk_bridge_key_event_listener_id)
!           atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
  
    deregister_application (app);
  }
***************
*** 617,625 ****
    spi_atk_bridge_init_nil (&e.any_data, object);
    if (BONOBO_EX (&ev))
        registry_died = TRUE;
!   else		    
        Accessibility_Registry_notifyEvent (spi_atk_bridge_get_registry (), 
  					  &e, &ev);
    if (BONOBO_EX (&ev))
      registry_died = TRUE;
  
--- 679,690 ----
    spi_atk_bridge_init_nil (&e.any_data, object);
    if (BONOBO_EX (&ev))
        registry_died = TRUE;
!   else {
!       atk_misc_threads_leave (misc);   
        Accessibility_Registry_notifyEvent (spi_atk_bridge_get_registry (), 
  					  &e, &ev);
+       atk_misc_threads_enter (misc);
+   }
    if (BONOBO_EX (&ev))
      registry_died = TRUE;
  
***************
*** 685,705 ****
  #endif
    CORBA_exception_init (&ev);
    registry = spi_atk_bridge_get_registry ();
!   if (registry_died) {
!       g_free (e.type);
!       return;
!   }  
!   Accessibility_Registry_notifyEvent (registry, 
! 				      &e, &ev);
  #ifdef SPI_BRIDGE_DEBUG
!   if (ev._major != CORBA_NO_EXCEPTION)
!       g_message ("error emitting event %s, (%d) %s",
! 		 e.type,
! 		 ev._major,
! 		 CORBA_exception_id(&ev));
  #endif	      
!   if (BONOBO_EX (&ev)) registry_died = TRUE;
!   
    if (source)
        bonobo_object_unref (BONOBO_OBJECT (source));
    else
--- 750,771 ----
  #endif
    CORBA_exception_init (&ev);
    registry = spi_atk_bridge_get_registry ();
!   if (!registry_died)
!   {
!     atk_misc_threads_leave (misc); 
!     Accessibility_Registry_notifyEvent (registry, 
!                                         &e, &ev);
!     atk_misc_threads_enter (misc);
  #ifdef SPI_BRIDGE_DEBUG
!     if (ev._major != CORBA_NO_EXCEPTION)
!         g_message ("error emitting event %s, (%d) %s",
!                    e.type,
!                    ev._major,
!                    CORBA_exception_id(&ev));
  #endif	      
!     if (BONOBO_EX (&ev)) registry_died = TRUE;
!   }
! 
    if (source)
        bonobo_object_unref (BONOBO_OBJECT (source));
    else
***************
*** 710,715 ****
--- 776,783 ----
    g_free (e.type);
  
    if (!any && e.any_data._release) CORBA_free (e.any_data._value);
+ 
+   if (any && any->_release) CORBA_free (any->_value);
    
    va_end (args);
  
***************
*** 861,866 ****
--- 929,936 ----
    spi_atk_emit_eventv (gobject, 0, 0, &any,
  		       "object:property-change:%s", prop_name);
  
+   if (s_ao) 
+     bonobo_object_unref (BONOBO_OBJECT (s_ao));
  
    return TRUE;
  }
***************
*** 1103,1108 ****
--- 1173,1181 ----
    if (sp) 
      g_free (sp);
  
+   if (s_ao)
+      bonobo_object_unref (BONOBO_OBJECT (s_ao));
+ 
    return TRUE;
  }
  
***************
*** 1196,1210 ****
        stateset = atk_object_ref_state_set (child);
        
        name = atk_object_get_name (child);
-       spi_atk_bridge_init_string (&any, child, (gchar**) &name);
        if (atk_state_set_contains_state (stateset, ATK_STATE_ACTIVE))
          {
            spi_atk_emit_eventv (G_OBJECT (child), 0, 0, &any, "window:deactivate");
            if (registry_died)
              return;
          }
        g_object_unref (stateset);
  
        spi_atk_emit_eventv (G_OBJECT (child), 0, 0, &any, "window:destroy");
        g_object_unref (child);
      }
--- 1269,1284 ----
        stateset = atk_object_ref_state_set (child);
        
        name = atk_object_get_name (child);
        if (atk_state_set_contains_state (stateset, ATK_STATE_ACTIVE))
          {
+           spi_atk_bridge_init_string (&any, child, (gchar**) &name);
            spi_atk_emit_eventv (G_OBJECT (child), 0, 0, &any, "window:deactivate");
            if (registry_died)
              return;
          }
        g_object_unref (stateset);
  
+       spi_atk_bridge_init_string (&any, child, (gchar**) &name);
        spi_atk_emit_eventv (G_OBJECT (child), 0, 0, &any, "window:destroy");
        g_object_unref (child);
      }
*** at-spi-858/configure.in	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/configure.in	2007-02-27 07:44:06.000000000 -0800
***************
*** 2,8 ****
  
  AT_SPI_MAJOR_VERSION=1
  AT_SPI_MINOR_VERSION=7
! AT_SPI_MICRO_VERSION=11
  AT_SPI_INTERFACE_AGE=0
  AT_SPI_BINARY_AGE=0
  AT_SPI_VERSION="$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION.$AT_SPI_MICRO_VERSION"
--- 2,8 ----
  
  AT_SPI_MAJOR_VERSION=1
  AT_SPI_MINOR_VERSION=7
! AT_SPI_MICRO_VERSION=16
  AT_SPI_INTERFACE_AGE=0
  AT_SPI_BINARY_AGE=0
  AT_SPI_VERSION="$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION.$AT_SPI_MICRO_VERSION"
***************
*** 27,35 ****
  
  dnl required versions of other tools.
  m4_define([req_ver_atk],	[1.12.0])
  m4_define([req_ver_libbonobo],	[1.107.0])
- m4_define([req_ver_gail],	[1.3.0])
- m4_define([req_ver_gtk],	[2.0.0])
  
  dnl Specify a header configuration file
  AM_CONFIG_HEADER(config.h)
--- 27,35 ----
  
  dnl required versions of other tools.
  m4_define([req_ver_atk],	[1.12.0])
+ m4_define([req_ver_gtk],	[2.10.0])
+ m4_define([req_ver_gail],	[1.9.0])
  m4_define([req_ver_libbonobo],	[1.107.0])
  
  dnl Specify a header configuration file
  AM_CONFIG_HEADER(config.h)
***************
*** 84,91 ****
  PKG_CHECK_MODULES(LIBSPI, [
  	libbonobo-2.0	>= req_ver_libbonobo
  	atk		>= req_ver_atk
- 	gtk+-2.0	>= req_ver_gtk
- 	gail		>= req_ver_gail
  ])
  AC_SUBST(LIBSPI_LIBS)
  AC_SUBST(LIBSPI_CFLAGS)
--- 84,89 ----
***************
*** 110,116 ****
  PKG_CHECK_MODULES(ATK_BRIDGE, [
  	libbonobo-2.0	>= req_ver_libbonobo
  	atk		>= req_ver_atk
! ])
  AC_SUBST(ATK_BRIDGE_LIBS)
  AC_SUBST(ATK_BRIDGE_CFLAGS)
  
--- 108,114 ----
  PKG_CHECK_MODULES(ATK_BRIDGE, [
  	libbonobo-2.0	>= req_ver_libbonobo
  	atk		>= req_ver_atk
! ])	
  AC_SUBST(ATK_BRIDGE_LIBS)
  AC_SUBST(ATK_BRIDGE_CFLAGS)
  
*** at-spi-858/cspi/bonobo/cspi-bonobo.c	2007-02-27 07:37:37.000000000 -0800
--- at-spi-881/cspi/bonobo/cspi-bonobo.c	2007-02-27 07:44:05.000000000 -0800
***************
*** 25,30 ****
--- 25,32 ----
  #include <string.h>
  #include <libbonobo.h>
  #include "../cspi-lowlevel.h"
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
  
  CORBA_Object
  cspi_dup_ref (CORBA_Object object)
***************
*** 114,140 ****
      return canonical_display_name;
  }
  
  CORBA_Object
  cspi_init (void)
  {
    char *obj_id;
    CORBA_Object registry;
    CORBA_Environment ev;
  
    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);
  
    if (ev._major != CORBA_NO_EXCEPTION)
      {
--- 116,168 ----
      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");
      }
  
    CORBA_exception_init (&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)
      {
*** at-spi-858/idl/Accessibility_Role.idl	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/idl/Accessibility_Role.idl	2007-02-27 07:44:06.000000000 -0800
***************
*** 366,375 ****
     */
    ROLE_REDUNDANT_OBJECT,
    /**
!    * The object is a containing instance of document content which constitutes
!    * a particular 'logical' section of the document.  The type of content within
!    * a section, and the nature of the section division itself, may be obtained
!    * by querying the object's attributes.  Sections may be nested.
     *
     * @since AT-SPI 1.7.6
     */
--- 366,382 ----
     */
    ROLE_REDUNDANT_OBJECT,
    /**
!    * The object is a containing instance of document content which
!    * has within it components with which the user can interact in order to
!    * input information; i.e. the object is a container for pushbuttons,
!    * comboboxes, text input fields, and other 'GUI' components.
!    * ROLE_FORM should not, in general, be used for toplevel GUI containers
!    * or dialogs, but should be reserved for 'GUI' containers which occur within
!    * document content, for instance within Web documents, presentations, or 
!    * text documents.  Unlike other GUI containers and dialogs which occur inside
!    * application instances, ROLE_FORM containers' components are associated with
!    * the current document, rather than the current foreground application or
!    * viewer instance.
     *
     * @since AT-SPI 1.7.6
     */
*** at-spi-858/libspi/text.c	2007-02-27 07:37:36.000000000 -0800
--- at-spi-881/libspi/text.c	2007-02-27 07:44:04.000000000 -0800
***************
*** 551,556 ****
--- 551,557 ----
  					       &intstart_offset, &intend_offset);
  
       if (attributes) total_attributes = n_attributes = g_slist_length (attributes);
+ 
       if (includeDefaults)
       {
  	 default_attributes = atk_text_get_default_attributes (text);
***************
*** 562,574 ****
       *startOffset = intstart_offset;
       *endOffset = intend_offset; 
  
       if (total_attributes)
!      {
! 	 retval = CORBA_sequence_CORBA_string__alloc ();
! 	 retval->_length = retval->_maximum = total_attributes;
! 	 retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (total_attributes);
! 	 CORBA_sequence_set_release (retval, CORBA_TRUE);
! 	 
  	 for (i = 0; i < n_attributes; ++i)
  	 {
  	     attr = g_slist_nth_data (attributes, i);
--- 563,575 ----
       *startOffset = intstart_offset;
       *endOffset = intend_offset; 
  
+      retval = CORBA_sequence_CORBA_string__alloc ();
+      retval->_length = retval->_maximum = total_attributes;
+      retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (total_attributes);
+      CORBA_sequence_set_release (retval, CORBA_TRUE);
+ 
       if (total_attributes)
!      {	 
  	 for (i = 0; i < n_attributes; ++i)
  	 {
  	     attr = g_slist_nth_data (attributes, i);
***************
*** 577,583 ****
  	 
  	 for (j = 0; j < n_default_attributes; ++i, ++j)
  	 {
! 	     attr = g_slist_nth_data (default_attributes, i);
  	     retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
  	 }
  	 
--- 578,584 ----
  	 
  	 for (j = 0; j < n_default_attributes; ++i, ++j)
  	 {
! 	     attr = g_slist_nth_data (default_attributes, j);
  	     retval->_buffer[i] = CORBA_string_dup (g_strconcat (attr->name, ":", attr->value, NULL));
  	 }
  	 
*** at-spi-858/registryd/deviceeventcontroller.c	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/registryd/deviceeventcontroller.c	2007-02-27 07:44:06.000000000 -0800
***************
*** 458,463 ****
--- 458,465 ----
  	  }
  	else
  	  spi_dec_set_unlatch_pending (controller, mask_return);
+ 
+         CORBA_free (e.any_data._value);
        }
        return TRUE;
      }
***************
*** 473,478 ****
--- 475,481 ----
  		     int *x, int *y, gboolean *moved)
  {
    Accessibility_Event e;
+   Accessibility_EventDetails *details;
    CORBA_Environment ev;
    int win_x_return,win_y_return;
    unsigned int mask_return;
***************
*** 510,515 ****
--- 513,520 ----
        Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
  					  &e,
  					  &ev);
+       details = e.any_data._value;
+       CORBA_free (details);
        e.type = "mouse:rel";  
        e.source = BONOBO_OBJREF (controller->registry->desktop);
        e.detail1 = *x - last_mouse_pos->x;
***************
*** 524,529 ****
--- 529,536 ----
        Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
  					  &e,
  					  &ev);
+       details = e.any_data._value;
+       CORBA_free (details);
        *moved = True;
      }
    else
***************
*** 564,569 ****
--- 571,577 ----
    Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
  				      &e,
  				      &ev);
+   CORBA_free (e.any_data._value);
  }
  
  static gboolean
***************
*** 1083,1088 ****
--- 1091,1097 ----
        Accessibility_Registry_notifyEvent (BONOBO_OBJREF (controller->registry),
  					  &e,
  					  &ev);
+       CORBA_free (e.any_data._value);
      }
  
    xkb_mod_unlatch_occurred = (xevent->type == ButtonPress ||
***************
*** 2509,2514 ****
--- 2518,2524 ----
  {
    CORBA_Environment ev;
    Accessibility_DeviceEvent key_event;
+   gboolean ret;
  
    g_assert (event->type == KeyPress || event->type == KeyRelease);
  
***************
*** 2520,2526 ****
      spi_controller_update_key_grabs (controller, &key_event);
  
    /* relay to listeners, and decide whether to consume it or not */
!   return spi_controller_notify_keylisteners (controller, &key_event, CORBA_TRUE, &ev);
  }
  
  SpiDEController *
--- 2530,2538 ----
      spi_controller_update_key_grabs (controller, &key_event);
  
    /* relay to listeners, and decide whether to consume it or not */
!   ret = spi_controller_notify_keylisteners (controller, &key_event, CORBA_TRUE, &ev);
!   CORBA_free(key_event.event_string);
!   return ret;
  }
  
  SpiDEController *
*** at-spi-858/registryd/registry-main.c	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/registryd/registry-main.c	2007-02-27 07:44:06.000000000 -0800
***************
*** 27,37 ****
  
  #include <config.h>
  #include <string.h>
! #include <gdk/gdk.h>
  #include <libbonobo.h>
  #include <glib/gmain.h>
  #include "registry.h"
  
  int
  main (int argc, char **argv)
  {
--- 27,41 ----
  
  #include <config.h>
  #include <string.h>
! #include <gdk/gdkx.h>
  #include <libbonobo.h>
  #include <glib/gmain.h>
  #include "registry.h"
  
+ #define spi_get_display() GDK_DISPLAY()
+ 
+ static void registry_set_ior (SpiRegistry *registry);
+ 
  int
  main (int argc, char **argv)
  {
***************
*** 40,46 ****
    const char  *display_name;
    char        *cp, *dp;
    SpiRegistry *registry;
-   GSList      *reg_env = NULL;
  
    if (!bonobo_init (&argc, argv))
      {
--- 44,49 ----
***************
*** 54,72 ****
    display_name = g_getenv ("AT_SPI_DISPLAY");
    if (!display_name)
    {
!       display_name = g_strdup (gdk_display_get_name (gdk_display_get_default ()));
        cp = strrchr (display_name, '.');
        dp = strrchr (display_name, ':');
        if (cp && dp && (cp > dp)) *cp = '\0';
    }
  
-   reg_env = bonobo_activation_registration_env_set ( reg_env, "AT_SPI_DISPLAY", 
- 						     display_name);
    ret = bonobo_activation_register_active_server (
  	  obj_id,
  	  bonobo_object_corba_objref (bonobo_object (registry)),
! 	  reg_env);
!   bonobo_activation_registration_env_free (reg_env);
  
    if (ret != Bonobo_ACTIVATION_REG_SUCCESS)
      {
--- 57,72 ----
    display_name = g_getenv ("AT_SPI_DISPLAY");
    if (!display_name)
    {
!       display_name = g_getenv ("DISPLAY");
        cp = strrchr (display_name, '.');
        dp = strrchr (display_name, ':');
        if (cp && dp && (cp > dp)) *cp = '\0';
    }
  
    ret = bonobo_activation_register_active_server (
  	  obj_id,
  	  bonobo_object_corba_objref (bonobo_object (registry)),
! 	  NULL);
  
    if (ret != Bonobo_ACTIVATION_REG_SUCCESS)
      {
***************
*** 79,87 ****
--- 79,117 ----
  #ifdef AT_SPI_DEBUG
        fprintf (stderr, "SpiRegistry Message: SpiRegistry daemon is running.\n");
  #endif
+       registry_set_ior (registry);
        bonobo_main ();
      }
  
    return 0;
  }
  
+ static void
+ registry_set_ior (SpiRegistry *registry){
+   CORBA_Environment ev;
+   Atom  AT_SPI_IOR = XInternAtom (spi_get_display (), "AT_SPI_IOR", FALSE);
+   char *iorstring = NULL;
+ 
+   CORBA_exception_init (&ev);
+ 
+   iorstring = CORBA_ORB_object_to_string (bonobo_activation_orb_get (),
+                                      bonobo_object_corba_objref (bonobo_object (registry)),
+                                      &ev);
+ 
+   XChangeProperty (spi_get_display(),
+ 		   XDefaultRootWindow (spi_get_display ()),
+ 		   AT_SPI_IOR, (Atom) 31, 8,
+ 		   PropModeReplace,
+ 		   (unsigned char *) iorstring,
+ 		   iorstring ? strlen (iorstring) : 0);
+ 
+   if (ev._major != CORBA_NO_EXCEPTION)
+ 	  {
+ 		  g_error ("Error setting IOR %s",
+ 			   CORBA_exception_id (&ev));
+                   CORBA_exception_free (&ev);
+            }
+ 
+   CORBA_exception_free (&ev);
+ 
+ }
*** at-spi-858/registryd/registry.c	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/registryd/registry.c	2007-02-27 07:44:06.000000000 -0800
***************
*** 602,608 ****
    CORBA_Environment  *ev;
    Bonobo_Unknown      source;
    EventTypeStruct     etype;
!   Accessibility_Event e_out;
  } NotifyContext;
  
  static SpiReEntrantContinue
--- 602,608 ----
    CORBA_Environment  *ev;
    Bonobo_Unknown      source;
    EventTypeStruct     etype;
!   Accessibility_Event *e_out;
  } NotifyContext;
  
  static SpiReEntrantContinue
***************
*** 634,645 ****
  	}
  #endif
        
!       ctx->e_out.source = ctx->source;
        
        if ((*list) && (*list)->data == ls)
          {
            Accessibility_EventListener_notifyEvent (
!             (Accessibility_EventListener) ls->listener, &ctx->e_out, ctx->ev);
            if (ctx->ev->_major != CORBA_NO_EXCEPTION)
              {
                DBG (1, g_warning ("Accessibility app error: exception during "
--- 634,645 ----
  	}
  #endif
        
!       ctx->e_out->source = ctx->source;
        
        if ((*list) && (*list)->data == ls)
          {
            Accessibility_EventListener_notifyEvent (
!             (Accessibility_EventListener) ls->listener, ctx->e_out, ctx->ev);
            if (ctx->ev->_major != CORBA_NO_EXCEPTION)
              {
                DBG (1, g_warning ("Accessibility app error: exception during "
***************
*** 679,689 ****
    new_ctx->etype.major = ctx->etype.major;
    new_ctx->etype.minor = ctx->etype.minor;
    new_ctx->etype.detail = ctx->etype.detail;
!   new_ctx->e_out.type = CORBA_string_dup (ctx->e_out.type);
!   new_ctx->e_out.source = ctx->e_out.source;
!   new_ctx->e_out.detail1 = ctx->e_out.detail1;
!   new_ctx->e_out.detail2 = ctx->e_out.detail2;
!   CORBA_any__copy (&(new_ctx->e_out.any_data), &(ctx->e_out.any_data));
    return new_ctx;
  }
  
--- 679,685 ----
    new_ctx->etype.major = ctx->etype.major;
    new_ctx->etype.minor = ctx->etype.minor;
    new_ctx->etype.detail = ctx->etype.detail;
!   new_ctx->e_out = ORBit_copy_value (ctx->e_out, TC_Accessibility_Event);
    return new_ctx;
  }
  
***************
*** 717,725 ****
        bonobo_object_release_unref (q_ctx->source, NULL);
      }
      CORBA_free ((void *)q_ctx->etype.event_name);
!     CORBA_free ((void *)q_ctx->e_out.type);
!     if (q_ctx->e_out.any_data._type != TC_null) 
! 	CORBA_free ((void *)q_ctx->e_out.any_data._value);
      g_free (q_ctx);
    }
    registry->is_queueing = FALSE;
--- 713,719 ----
        bonobo_object_release_unref (q_ctx->source, NULL);
      }
      CORBA_free ((void *)q_ctx->etype.event_name);
!     CORBA_free (q_ctx->e_out);
      g_free (q_ctx);
    }
    registry->is_queueing = FALSE;
***************
*** 834,858 ****
  static gboolean
  registry_queue_event (SpiRegistry *registry, NotifyContext *ctx)
  {
-   NotifyContext *q_ctx = registry_clone_notify_context (ctx);
  #ifdef SPI_QUEUE_DEBUG
!     if (q_ctx->etype.type_cat != ETYPE_MOUSE)
!       fprintf (stderr, "push! %s %p\n", q_ctx->etype.event_name, q_ctx);
  #endif    
    if (registry->is_queueing)
      {
        g_queue_push_head (registry->deferred_event_queue, q_ctx);
  
        return FALSE;
      }
    else
      {
-       bonobo_object_release_unref (q_ctx->source, NULL);
-       CORBA_free ((void *)q_ctx->etype.event_name);
-       CORBA_free ((void *)q_ctx->e_out.type);
-       if (q_ctx->e_out.any_data._type != TC_null) 
- 	  CORBA_free ((void *)q_ctx->e_out.any_data._value);
-       g_free (q_ctx);
        return TRUE; 
      }
  }
--- 828,847 ----
  static gboolean
  registry_queue_event (SpiRegistry *registry, NotifyContext *ctx)
  {
  #ifdef SPI_QUEUE_DEBUG
!     if (ctx->etype.type_cat != ETYPE_MOUSE)
!       fprintf (stderr, "push! %s %p\n", ctx->etype.event_name, ctx);
  #endif    
    if (registry->is_queueing)
      {
+       NotifyContext *q_ctx = registry_clone_notify_context (ctx);
+ 
        g_queue_push_head (registry->deferred_event_queue, q_ctx);
  
        return FALSE;
      }
    else
      {
        return TRUE; 
      }
  }
***************
*** 917,923 ****
    parse_event_type (&ctx.etype, e->type);
  
    ctx.ev = ev;
!   ctx.e_out = *e;
    ctx.source = e->source;
  
  #ifdef SPI_QUEUE_DEBUG
--- 906,912 ----
    parse_event_type (&ctx.etype, e->type);
  
    ctx.ev = ev;
!   ctx.e_out = (Accessibility_Event *)e;
    ctx.source = e->source;
  
  #ifdef SPI_QUEUE_DEBUG
*** at-spi-858/registryd/registry.h	2007-02-27 07:37:38.000000000 -0800
--- at-spi-881/registryd/registry.h	2007-02-27 07:44:06.000000000 -0800
***************
*** 25,31 ****
  #define SPI_REGISTRY_H_
  
  #include <glib/gmain.h>
- #include <gdk/gdk.h>
  #include <libspi/listener.h>
  
  typedef struct _SpiRegistry SpiRegistry;
--- 25,30 ----
