Re: [g-a-devel]layered patch ...



On Mon, 2002-12-16 at 17:47, Michael Meeks wrote:
> So, here we are again - with more layering:


Thanks, looks good.

Please commit!


and thanks again for revising the patch.

-Bill

	HTH,
> 
> 		Michael.
> 
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/at-spi/ChangeLog,v
> retrieving revision 1.270
> diff -u -p -u -r1.270 ChangeLog
> --- ChangeLog	13 Dec 2002 13:58:39 -0000	1.270
> +++ ChangeLog	16 Dec 2002 17:45:16 -0000
> @@ -1,3 +1,69 @@
> +2002-12-16  Michael Meeks  <michael ximian com>
> +
> +	* cspi/spi_accessible.c (spi_state_to_corba): rename.
> +
> +	* libspi/stateset.c (state_spi_to_atk): split out
> +	( fix several remote array bounds nasties )
> +	(spi_atk_state_set_from_sequence, impl_contains, impl_add),
> +	(impl_remove): make safe from array bounds issues.
> +	(spi_atk_state_from_spi_state): impl.
> +
> +	* libspi/stateset.h (spi_state_set_cache_is_empty): 
> +	add a set of wrapper defines to get layering right.
> +
> +	* cspi/spi_accessible.c: update state set stuff to
> +	use it.
> +
> +2002-12-14  Michael Meeks  <michael ximian com>
> +
> +	* atk-bridge/bridge.c (spi_atk_bridget_get_dec): impl.
> +	to avoid 2 roundtrips to the registry per key event
> +	(spi_atk_bridge_key_listener): upd.
> +	(deregister_application): release the dec.
> +
> +	* registryd/registry.c (notify_listeners_cb):
> +	bin lots of re-enterant complexity - we no longer
> +	do a round-trip bonobo ref here, ensure that a single
> +	listener's exception failure won't poison all other
> +	notifications.
> +	(impl_registry_notify_event): bin obvious memory leak.
> +
> +2002-12-13  Michael Meeks  <michael ximian com>
> +
> +	* atk-bridge/bridge.c (spi_atk_bridge_focus_tracker):
> +	init the ev so the error is meaningful.
> +	(spi_atk_bridge_key_listener): ditto.
> +
> +	* cspi/spi_main.c (cspi_ev): init the ev so we start
> +	with a clean slate, otherwise the first exception
> +	kills us completely.
> +
> +	* cspi/spi_text.c (get_accessible_text_boundary_type): 
> +	add a fallthrough for no warnings.
> +
> +	* cspi/spi_registry.c: prune unused warnings.
> +
> +	* cspi/spi_main.c (cspi_object_take): fix
> +	mind-blowing brokenness ( by watching the compile
> +	warnings )
> +
> +	* cspi/spi_accessible.c (Accessible_getStateSet):
> +	re-impl. to use an AtkStateSet.
> +	(spi_state_type_from_accessible_state),
> +	(init_state_table): bin these.
> +
> +	* libspi/stateset.c (spi_atk_state_set_from_sequence):
> +	split out from
> +	(atk_state_set_from_accessibility_state_set): here.
> +
> +	* cspi/spi_accessible.c (spi_state_to_atk): impl.
> +	(AccessibleStateSet_contains, AccessibleStateSet_ref),
> +	(AccessibleStateSet_unref, AccessibleStateSet_contains),
> +	(AccessibleStateSet_add, AccessibleStateSet_remove),
> +	(AccessibleStateSet_equals, AccessibleStateSet_compare),
> +	(AccessibleStateSet_isEmpty): re-write to use a local
> +	AtkStateSet object.
> +
>  2002-12-13  Bill Haneman <bill haneman sun com>
>  
>  	* configure.in: Revved to 1.1.7 (new keymask vals).
> Index: TODO
> ===================================================================
> RCS file: /cvs/gnome/at-spi/TODO,v
> retrieving revision 1.11
> diff -u -p -u -r1.11 TODO
> --- TODO	4 Jun 2002 12:16:39 -0000	1.11
> +++ TODO	16 Dec 2002 17:45:16 -0000
> @@ -1,3 +1,7 @@
> +Optimisation:
> +	+ async unref's ...
> +	+ cache Role & queryInterface results ... [!]
> +
>  2.0.0:
>  
>  	+ fix bug #82509 which prevents return of boolean FALSE from 
> Index: atk-bridge/bridge.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/atk-bridge/bridge.c,v
> retrieving revision 1.56
> diff -u -p -u -r1.56 bridge.c
> --- atk-bridge/bridge.c	9 Dec 2002 08:29:21 -0000	1.56
> +++ atk-bridge/bridge.c	16 Dec 2002 17:45:16 -0000
> @@ -41,10 +41,9 @@
>  #define DBG(a,b) if(_dbg>=(a))b
>  
>  static int _dbg = 0;
> -static char *spi_nil_string = "";
> -
>  static CORBA_Environment ev;
> -static Accessibility_Registry registry = NULL;
> +static Accessibility_Registry registry = CORBA_OBJECT_NIL;
> +static Accessibility_DeviceEventController device_event_controller =
> CORBA_OBJECT_NIL;
>  static SpiApplication *this_app = NULL;
>  static gboolean registry_died = FALSE;
>  static gboolean atk_listeners_registered = FALSE;
> @@ -225,7 +224,7 @@ spi_atk_bridge_register_application (Acc
>  }
>  
>  static Accessibility_Registry
> -spi_atk_bridge_get_registry ()
> +spi_atk_bridge_get_registry (void)
>  {
>    CORBA_Environment ev;
>  
> @@ -252,6 +251,34 @@ spi_atk_bridge_get_registry ()
>    return registry;
>  }
>  
> +static Accessibility_DeviceEventController
> +spi_atk_bridget_get_dec (void)
> +{
> +  CORBA_Environment ev;
> +
> +  if (device_event_controller != CORBA_OBJECT_NIL)
> +    {
> +      if (ORBit_small_get_connection_status (device_event_controller)
> +	  == ORBIT_CONNECTION_CONNECTED)
> +        return device_event_controller;
> +    }
> +
> +  CORBA_exception_init (&ev);
> +
> +  device_event_controller =
> +    Accessibility_Registry_getDeviceEventController (
> +	    spi_atk_bridge_get_registry (), &ev);
> +
> +  if (BONOBO_EX (&ev))
> +    {
> +      g_warning ("failure: no deviceeventcontroller found\n");
> +      registry_died = TRUE;
> +      device_event_controller = CORBA_OBJECT_NIL;
> +    }
> +
> +  return device_event_controller;
> +}
> +
>  int
>  gtk_module_init (gint *argc, gchar **argv[])
>  {
> @@ -352,6 +379,7 @@ deregister_application (BonoboObject *ap
>    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);
>    
>    app = bonobo_object_unref (app);
> @@ -442,10 +470,13 @@ spi_atk_bridge_focus_tracker (AtkObject 
>    e.detail1 = 0;
>    e.detail2 = 0;
>    spi_init_any_nil (&e.any_data);
> +
> +  CORBA_exception_init (&ev);
>    Accessibility_Registry_notifyEvent (spi_atk_bridge_get_registry (),
> &e, &ev);
> -  if (BONOBO_EX (&ev)) registry_died = TRUE;
> -  
> -  Accessibility_Accessible_unref (e.source, &ev);
> +  if (BONOBO_EX (&ev))
> +    registry_died = TRUE;
> +
> +  bonobo_object_unref (source);
>    
>    CORBA_exception_free (&ev);
>  }
> @@ -646,33 +677,15 @@ spi_atk_bridge_key_listener (AtkKeyEvent
>  {
>    CORBA_boolean             result;
>    Accessibility_DeviceEvent key_event;
> -  Accessibility_DeviceEventController controller;
> -	
> -  if (BONOBO_EX (&ev))
> -	g_warning ("failure: pre-listener get dec\n");
>  
> -  controller =
> -    Accessibility_Registry_getDeviceEventController (
> -	    spi_atk_bridge_get_registry (), &ev);
> +  CORBA_exception_init (&ev);
>  
> -  if (BONOBO_EX (&ev))
> -    {
> -      g_warning ("failure: no deviceeventcontroller found\n");
> -      CORBA_exception_free (&ev);
> -      registry_died = TRUE;
> -      result = FALSE;
> -    }
> -  else
> -    {
> +  spi_init_keystroke_from_atk_key_event (&key_event, event);
>  
> -      spi_init_keystroke_from_atk_key_event (&key_event, event);
> +  result = Accessibility_DeviceEventController_notifyListenersSync (
> +	  spi_atk_bridget_get_dec (), &key_event, &ev);
>  
> -      result = Accessibility_DeviceEventController_notifyListenersSync
> (
> -        controller, &key_event, &ev);
> -
> -      bonobo_object_release_unref (controller, &ev);
> -      CORBA_exception_free (&ev);
> -    }
> +  CORBA_exception_free (&ev);
>  
>    return result;
>  }
> Index: cspi/spi-impl.h
> ===================================================================
> RCS file: /cvs/gnome/at-spi/cspi/spi-impl.h,v
> retrieving revision 1.16
> diff -u -p -u -r1.16 spi-impl.h
> --- cspi/spi-impl.h	17 Nov 2002 13:53:54 -0000	1.16
> +++ cspi/spi-impl.h	16 Dec 2002 17:45:16 -0000
> @@ -43,13 +43,13 @@ typedef Accessible AccessibleHypertext;
>  typedef Accessible AccessibleImage;
>  typedef Accessible AccessibleRelation;
>  typedef Accessible AccessibleSelection;
> -typedef Accessible AccessibleStateSet;
>  typedef Accessible AccessibleStreamableContent;
>  typedef Accessible AccessibleTable;
>  typedef Accessible AccessibleText;
>  typedef Accessible AccessibleValue;
>  typedef Accessible AccessibilityRegistry;
>  
> +typedef void AccessibleStateSet;
>  typedef void AccessibleEventListener;
>  typedef void AccessibleKeystrokeListener;
>  typedef void AccessibleDeviceListener;
> Index: cspi/spi-private.h
> ===================================================================
> RCS file: /cvs/gnome/at-spi/cspi/spi-private.h,v
> retrieving revision 1.11
> diff -u -p -u -r1.11 spi-private.h
> --- cspi/spi-private.h	6 Dec 2002 17:33:32 -0000	1.11
> +++ cspi/spi-private.h	16 Dec 2002 17:45:16 -0000
> @@ -39,6 +39,11 @@ struct _Accessible {
>  	guint        ref_count : 30;
>  };
>  
> +struct _AccessibleStateSet {
> +	guint   ref_count;
> +	GArray *states;
> +};
> +
>  #define SPI_INTERNAL_EVENT_MAGIC 0xc3
>  /* 
>   * For internal use by CSPI implementation only
> Index: cspi/spi_accessible.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/cspi/spi_accessible.c,v
> retrieving revision 1.44
> diff -u -p -u -r1.44 spi_accessible.c
> --- cspi/spi_accessible.c	20 Nov 2002 17:14:28 -0000	1.44
> +++ cspi/spi_accessible.c	16 Dec 2002 17:45:17 -0000
> @@ -22,6 +22,7 @@
>   */
>  
>  #include <stdlib.h> /* for malloc */
> +#include <libspi/stateset.h>
>  #include <cspi/spi-private.h>
>  
>  static const char *role_names [] =
> @@ -213,68 +214,6 @@ cspi_role_from_spi_role (Accessibility_R
>    return cspi_role; 
>  }
>  
> -static SPIBoolean
> -init_state_table (Accessibility_StateType *state_table)
> -{
> -  int i;
> -
> -  for (i = 0; i < Accessibility_STATE_LAST_DEFINED; i++)
> -    state_table[i] = SPI_STATE_INVALID;
> -
> -  state_table[SPI_STATE_ACTIVE] = Accessibility_STATE_ACTIVE;
> -  state_table[SPI_STATE_ARMED] = Accessibility_STATE_ARMED;
> -  state_table[SPI_STATE_BUSY] = Accessibility_STATE_BUSY;
> -  state_table[SPI_STATE_CHECKED] = Accessibility_STATE_CHECKED;
> -  state_table[SPI_STATE_DEFUNCT] = Accessibility_STATE_DEFUNCT;
> -  state_table[SPI_STATE_EDITABLE] = Accessibility_STATE_EDITABLE;
> -  state_table[SPI_STATE_ENABLED] = Accessibility_STATE_ENABLED;
> -  state_table[SPI_STATE_EXPANDABLE] = Accessibility_STATE_EXPANDABLE;
> -  state_table[SPI_STATE_EXPANDED] = Accessibility_STATE_EXPANDED;
> -  state_table[SPI_STATE_FOCUSABLE] = Accessibility_STATE_FOCUSABLE;
> -  state_table[SPI_STATE_FOCUSED] = Accessibility_STATE_FOCUSED;
> -  state_table[SPI_STATE_HORIZONTAL] = Accessibility_STATE_HORIZONTAL;
> -  state_table[SPI_STATE_ICONIFIED] = Accessibility_STATE_ICONIFIED;
> -  state_table[SPI_STATE_MODAL] = Accessibility_STATE_MODAL;
> -  state_table[SPI_STATE_MULTI_LINE] = Accessibility_STATE_MULTI_LINE;
> -  state_table[SPI_STATE_MULTISELECTABLE] =
> Accessibility_STATE_MULTISELECTABLE;
> -  state_table[SPI_STATE_OPAQUE] = Accessibility_STATE_OPAQUE;
> -  state_table[SPI_STATE_PRESSED] = Accessibility_STATE_PRESSED;
> -  state_table[SPI_STATE_RESIZABLE] = Accessibility_STATE_RESIZABLE;
> -  state_table[SPI_STATE_SELECTABLE] = Accessibility_STATE_SELECTABLE;
> -  state_table[SPI_STATE_SELECTED] = Accessibility_STATE_SELECTED;
> -  state_table[SPI_STATE_SENSITIVE] = Accessibility_STATE_SENSITIVE;
> -  state_table[SPI_STATE_SHOWING] = Accessibility_STATE_SHOWING;
> -  state_table[SPI_STATE_SINGLE_LINE] = Accessibility_STATE_SINGLE_LINE;
> -  state_table[SPI_STATE_STALE] = Accessibility_STATE_STALE;
> -  state_table[SPI_STATE_TRANSIENT] = Accessibility_STATE_TRANSIENT;
> -  state_table[SPI_STATE_VERTICAL] = Accessibility_STATE_VERTICAL;
> -  state_table[SPI_STATE_VISIBLE] = Accessibility_STATE_VISIBLE;
> -  state_table[SPI_STATE_MANAGES_DESCENDANTS] =
> Accessibility_STATE_MANAGES_DESCENDANTS;
> -
> -  return TRUE;
> -}
> -
> -
> -
> -static Accessibility_StateType
> -spi_state_type_from_accessible_state (AccessibleState type)
> -{
> -  static Accessibility_StateType
> state_table[Accessibility_STATE_LAST_DEFINED];
> -  static SPIBoolean table_initialized = FALSE;
> -  Accessibility_StateType rv;
> -  
> -  if (!table_initialized)
> -    table_initialized = init_state_table (state_table);  
> -  if (type > SPI_STATE_INVALID && type < SPI_STATE_LAST_DEFINED)
> -    rv = state_table[type];
> -  else
> -    rv = Accessibility_STATE_INVALID;
> -  return rv;
> -}
> -
> -
> -
> -
>  /**
>   * AccessibleRole_getName:
>   * @role: an #AccessibleRole object to query.
> @@ -570,14 +509,23 @@ AccessibleStateSet *
>  Accessible_getStateSet (Accessible *obj)
>  {
>    AccessibleStateSet *retval;
> +  Accessibility_StateSet corba_stateset;
> +  Accessibility_StateSeq *corba_seq;
>  
>    cspi_return_val_if_fail (obj != NULL, NULL);
>  
> -  retval = cspi_object_add (
> -    Accessibility_Accessible_getState (CSPI_OBJREF (obj),
> -					  cspi_ev ()));
> +  corba_stateset = Accessibility_Accessible_getState (
> +	  CSPI_OBJREF (obj), cspi_ev ());
> +  cspi_return_val_if_ev ("getState", NULL);
>  
> +  corba_seq = Accessibility_StateSet_getStates (corba_stateset, cspi_ev
> ());
>    cspi_return_val_if_ev ("getState", NULL);
> +
> +  retval = (AccessibleStateSet *) spi_atk_state_set_from_sequence
> (corba_seq);
> +
> +  CORBA_free (corba_seq);
> +  cspi_release_unref (corba_stateset);
> +
>    return retval;
>  }
>  
> @@ -1097,7 +1045,7 @@ AccessibleRelation_getTarget (Accessible
>  void
>  AccessibleStateSet_ref (AccessibleStateSet *obj)
>  {
> -  cspi_object_ref (obj);
> +  spi_state_set_cache_ref (obj);
>  }
>  
>  /**
> @@ -1110,9 +1058,54 @@ AccessibleStateSet_ref (AccessibleStateS
>  void
>  AccessibleStateSet_unref (AccessibleStateSet *obj)
>  {
> -  cspi_object_unref (obj);
> +  spi_state_set_cache_unref (obj);
>  }
>  
> +static Accessibility_StateType
> +spi_state_to_corba (AccessibleState state)
> +{
> +#define MAP_STATE(a) \
> +  case SPI_STATE_##a: \
> +    return Accessibility_STATE_##a
> +
> +  switch (state)
> +    {
> +      MAP_STATE (INVALID);
> +      MAP_STATE (ACTIVE);
> +      MAP_STATE (ARMED);
> +      MAP_STATE (BUSY);
> +      MAP_STATE (CHECKED);
> +      MAP_STATE (DEFUNCT);
> +      MAP_STATE (EDITABLE);
> +      MAP_STATE (ENABLED);
> +      MAP_STATE (EXPANDABLE);
> +      MAP_STATE (EXPANDED);
> +      MAP_STATE (FOCUSABLE);
> +      MAP_STATE (FOCUSED);
> +      MAP_STATE (HORIZONTAL);
> +      MAP_STATE (ICONIFIED);
> +      MAP_STATE (MODAL);
> +      MAP_STATE (MULTI_LINE);
> +      MAP_STATE (MULTISELECTABLE);
> +      MAP_STATE (OPAQUE);
> +      MAP_STATE (PRESSED);
> +      MAP_STATE (RESIZABLE);
> +      MAP_STATE (SELECTABLE);
> +      MAP_STATE (SELECTED);
> +      MAP_STATE (SENSITIVE);
> +      MAP_STATE (SHOWING);
> +      MAP_STATE (SINGLE_LINE);
> +      MAP_STATE (STALE);
> +      MAP_STATE (TRANSIENT);
> +      MAP_STATE (VERTICAL);
> +      MAP_STATE (VISIBLE);
> +      MAP_STATE (MANAGES_DESCENDANTS);
> +    default:
> +      return ATK_STATE_INVALID;
> +  }
> +#undef MAP_STATE
> +}	      
> +
>  /**
>   * AccessibleStateSet_contains:
>   * @obj: a pointer to the #AccessibleStateSet object on which to
> operate.
> @@ -1130,18 +1123,7 @@ SPIBoolean
>  AccessibleStateSet_contains (AccessibleStateSet *obj,
>  			     AccessibleState state)
>  {
> -  CORBA_boolean retval;
> -  Accessibility_StateType spi_state;
> -  
> -  cspi_return_val_if_fail (obj != NULL, FALSE);
> -
> -  spi_state = spi_state_type_from_accessible_state (state);
> -  retval = Accessibility_StateSet_contains (CSPI_OBJREF (obj),
> -					    spi_state, cspi_ev ());
> -
> -  cspi_return_val_if_ev ("contains", FALSE);
> -
> -  return retval;
> +  return spi_state_set_cache_contains (obj, spi_state_to_corba
> (state));
>  }
>  
>  /**
> @@ -1157,13 +1139,7 @@ void
>  AccessibleStateSet_add (AccessibleStateSet *obj,
>  			AccessibleState state)
>  {
> -  Accessibility_StateType spi_state;
> -
> -  cspi_return_if_fail (obj != NULL);
> -
> -  spi_state = spi_state_type_from_accessible_state (state);
> -  Accessibility_StateSet_add (CSPI_OBJREF (obj), spi_state, cspi_ev
> ());
> -  cspi_check_ev ("StateSet_add");
> +  spi_state_set_cache_add (obj, spi_state_to_corba (state));
>  }
>  
>  /**
> @@ -1179,13 +1155,7 @@ void
>  AccessibleStateSet_remove (AccessibleStateSet *obj,
>  			   AccessibleState state)
>  {
> -  Accessibility_StateType spi_state;
> -
> -  cspi_return_if_fail (obj != NULL);
> -
> -  spi_state = spi_state_type_from_accessible_state (state);
> -  Accessibility_StateSet_remove (CSPI_OBJREF (obj), spi_state, cspi_ev
> ());
> -  cspi_check_ev ("StateSet_remove");
> +  spi_state_set_cache_remove (obj, spi_state_to_corba (state));
>  }
>  
>  /**
> @@ -1207,16 +1177,19 @@ SPIBoolean
>  AccessibleStateSet_equals (AccessibleStateSet *obj,
>                             AccessibleStateSet *obj2)
>  {
> +  SPIBoolean   eq;
> +  AtkStateSet *cmp;
> +
>    if (obj == obj2)
>      {
>        return TRUE;
>      }
>  
> -  cspi_return_val_if_fail (obj != NULL, FALSE);
> -  cspi_return_val_if_fail (obj2 != NULL, FALSE);
> +  cmp = spi_state_set_cache_xor (obj, obj2);
> +  eq = spi_state_set_cache_is_empty (cmp);
> +  spi_state_set_cache_unref (cmp);
>  
> -  return Accessibility_StateSet_equals (CSPI_OBJREF (obj),
> -					CSPI_OBJREF (obj2), cspi_ev ());
> +  return eq;
>  }
>  
>  /**
> @@ -1237,15 +1210,8 @@ AccessibleStateSet *
>  AccessibleStateSet_compare (AccessibleStateSet *obj,
>                              AccessibleStateSet *obj2)
>  {
> -  AccessibleStateSet *retval;
> -
> -  cspi_return_val_if_fail (obj != NULL, NULL);
> -  cspi_return_val_if_fail (obj2 != NULL, NULL);
> -  retval = cspi_object_add (
> -			 Accessibility_StateSet_compare (CSPI_OBJREF(obj),
> CSPI_OBJREF(obj2), cspi_ev ()));
> -
> -  cspi_return_val_if_ev ("compare", NULL);
> -  return retval;
> +  return (AccessibleStateSet *)
> +	spi_state_set_cache_xor (obj, obj2);
>  }
>  
>  /**
> @@ -1261,13 +1227,7 @@ AccessibleStateSet_compare (AccessibleSt
>  SPIBoolean
>  AccessibleStateSet_isEmpty (AccessibleStateSet *obj)
>  {
> -  CORBA_boolean retval;
> -
> -  cspi_return_val_if_fail (obj != NULL, FALSE);
> -  retval = Accessibility_StateSet_isEmpty (CSPI_OBJREF (obj), cspi_ev
> ());
> -
> -  cspi_return_val_if_ev ("isEmpty", TRUE);
> -  return retval;
> +  return spi_state_set_cache_is_empty (obj);
>  }
>  
> 
> Index: cspi/spi_event.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/cspi/spi_event.c,v
> retrieving revision 1.27
> diff -u -p -u -r1.27 spi_event.c
> --- cspi/spi_event.c	10 Dec 2002 11:45:46 -0000	1.27
> +++ cspi/spi_event.c	16 Dec 2002 17:45:17 -0000
> @@ -354,9 +354,10 @@ static Accessible *
>  cspi_internal_event_get_object (const InternalEvent *e)
>  {
>    CORBA_any *any;
> -  Accessible *accessible;
> +
>    g_return_val_if_fail (e, NULL);
>    g_return_val_if_fail (e->data, NULL);
> +
>    any = (CORBA_any *) e->data;
>    if (CORBA_TypeCode_equal (any->_type, TC_CORBA_Object, cspi_ev()))
>      return cspi_object_take (* (CORBA_Object *) any->_value);
> Index: cspi/spi_main.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/cspi/spi_main.c,v
> retrieving revision 1.30
> diff -u -p -u -r1.30 spi_main.c
> --- cspi/spi_main.c	6 Dec 2002 17:33:32 -0000	1.30
> +++ cspi/spi_main.c	16 Dec 2002 17:45:17 -0000
> @@ -126,6 +126,7 @@ cspi_get_live_refs (void)
>  CORBA_Environment *
>  cspi_ev (void)
>  {
> +  CORBA_exception_init (&ev);
>    return &ev;
>  }
>  
> @@ -248,15 +249,17 @@ cspi_object_take (CORBA_Object corba_obj
>  {
>    Accessible *accessible;
>    accessible = cspi_object_borrow (corba_object);
> -  cspi_object_ref (accessible->objref);
> +
> +  cspi_object_ref (accessible);
>    /* 
>     * if the remote object is dead, 
>     * cspi_object_return will throw an exception. 
> +   * FIXME: what clears that exception context ever ?
>     */
> -  cspi_object_return (accessible->objref);
> +  cspi_object_return (accessible);
>    if (cspi_exception ()) 
>      {
> -      cspi_object_unref (accessible->objref);
> +      cspi_object_unref (accessible);
>        accessible = NULL;
>      }
>    return accessible;
> Index: cspi/spi_registry.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/cspi/spi_registry.c,v
> retrieving revision 1.43
> diff -u -p -u -r1.43 spi_registry.c
> --- cspi/spi_registry.c	19 Nov 2002 20:04:17 -0000	1.43
> +++ cspi/spi_registry.c	16 Dec 2002 17:45:18 -0000
> @@ -332,7 +332,7 @@ SPI_registerAccessibleKeystrokeListener 
>  					 AccessibleKeyEventMask        eventmask,
>  					 AccessibleKeyListenerSyncType sync_type)
>  {
> -  gint                                i, mask;
> +  gint                                i;
>    Accessibility_KeySet                key_set;
>    Accessibility_KeyEventTypeSeq       key_events;
>    Accessibility_ControllerEventMask   controller_event_mask;
> @@ -488,7 +488,7 @@ SPI_registerDeviceEventListener (Accessi
>    SPIBoolean                          retval = FALSE;
>    Accessibility_EventTypeSeq          event_types;
>    Accessibility_EventType             event_type_buffer[2];
> -  gint                                i, mask;
> +  gint                                i;
>  
>    if (!listener)
>      {
> @@ -543,7 +543,6 @@ SPIBoolean
>  SPI_deregisterDeviceEventListener (AccessibleDeviceListener *listener,
>  				   void                     *filter)
>  {
> -  Accessibility_ControllerEventMask   controller_event_mask;
>    Accessibility_DeviceEventController device_event_controller;
>    Accessibility_EventTypeSeq       event_types;
>    Accessibility_EventType          event_type_buff[2];
> Index: cspi/spi_text.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/cspi/spi_text.c,v
> retrieving revision 1.21
> diff -u -p -u -r1.21 spi_text.c
> --- cspi/spi_text.c	17 Nov 2002 13:53:54 -0000	1.21
> +++ cspi/spi_text.c	16 Dec 2002 17:45:18 -0000
> @@ -58,6 +58,8 @@ get_accessible_text_boundary_type (Acces
>        return Accessibility_TEXT_BOUNDARY_CHAR;
>        break;
>      }
> +  /* FIXME */
> +  return Accessibility_TEXT_BOUNDARY_CHAR;
>  }
>  
> 
> Index: libspi/stateset.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/libspi/stateset.c,v
> retrieving revision 1.8
> diff -u -p -u -r1.8 stateset.c
> --- libspi/stateset.c	19 Nov 2002 13:48:56 -0000	1.8
> +++ libspi/stateset.c	16 Dec 2002 17:45:18 -0000
> @@ -118,7 +118,22 @@ spi_init_state_type_tables (void)
>    return TRUE;
>  }
>  
> +static inline AtkState
> +state_spi_to_atk (Accessibility_StateType state)
> +{
> +  guint idx = state;
> +  if (idx < Accessibility_STATE_LAST_DEFINED)
> +    return atk_state_types [idx];
> +  else
> +    return ATK_STATE_INVALID;
> +}
>  
> +AtkState
> +spi_atk_state_from_spi_state (Accessibility_StateType state)
> +{
> +  spi_init_state_type_tables ();
> +  return state_spi_to_atk (state);
> +}
>  
>  static AtkStateSet *
>  atk_state_set_from_servant (PortableServer_Servant servant)
> @@ -129,29 +144,39 @@ atk_state_set_from_servant (PortableServ
>    return  ATK_STATE_SET(base->gobj);
>  }
>  
> +AtkStateSet *
> +spi_atk_state_set_from_sequence (const Accessibility_StateSeq *seq)
> +{
> +  int i;
> +  AtkStateSet *set;
> +  AtkStateType *states;
>  
> +  spi_init_state_type_tables ();
> +  
> +  states = g_newa (AtkStateType, seq->_length);
> +  for (i = 0; i < seq->_length; i++)
> +    states [i] = state_spi_to_atk (seq->_buffer [i]);
> +
> +  set = atk_state_set_new ();
> +  atk_state_set_add_states (set, states, seq->_length);
> +
> +  return set;
> +}
>  
>  static AtkStateSet *
>  atk_state_set_from_accessibility_state_set (Accessibility_StateSet set,
> CORBA_Environment *ev)
>  {
> -  AtkStateType *states, *tmp;
>    AtkStateSet *rv;
> -  gint i;
>    Accessibility_StateSeq *seq;
>    
>    seq = Accessibility_StateSet_getStates (set, ev);
> -  states = tmp = g_new (AtkStateType, seq->_length);
> -  for (i = 0; i < seq->_length; i++)
> -    *tmp++ = atk_state_types[seq->_buffer[i]];
> -  rv = atk_state_set_new ();
> -  atk_state_set_add_states (rv, states, seq->_length);
> +  rv = spi_atk_state_set_from_sequence (seq);
>    CORBA_free (seq);
> -  g_free (states);
> +
>    return rv;
>  }
>  
> 
> -
>  SpiStateSet *
>  spi_state_set_new (AtkStateSet *obj)
>  {
> @@ -161,7 +186,6 @@ spi_state_set_new (AtkStateSet *obj)
>  }
>  
> 
> -
>  static CORBA_boolean
>  impl_contains (PortableServer_Servant servant,
>  	       const Accessibility_StateType state,
> @@ -170,24 +194,22 @@ impl_contains (PortableServer_Servant se
>    AtkStateSet *set = atk_state_set_from_servant (servant);
>  
>    g_return_val_if_fail (set, FALSE);
> -  return atk_state_set_contains_state (set, atk_state_types[state]);
> +  return atk_state_set_contains_state (set, state_spi_to_atk (state));
>  }
>  
> 
> -
>  static void 
> -impl_add(PortableServer_Servant servant,
> -    const Accessibility_StateType state,
> -    CORBA_Environment * ev)
> +impl_add (PortableServer_Servant servant,
> +	  const Accessibility_StateType state,
> +	  CORBA_Environment * ev)
>  {
>    AtkStateSet *set = atk_state_set_from_servant (servant);
>  
>    g_return_if_fail (set);
> -  atk_state_set_add_state (set, atk_state_types[state]);
> +  atk_state_set_add_state (set, state_spi_to_atk (state));
>  }
>  
> 
> -
>  static void 
>  impl_remove (PortableServer_Servant servant,
>  	     const Accessibility_StateType state,
> @@ -196,11 +218,10 @@ impl_remove (PortableServer_Servant serv
>    AtkStateSet *set = atk_state_set_from_servant (servant);
>  
>    g_return_if_fail (set);
> -  atk_state_set_remove_state (set, atk_state_types[state]);
> +  atk_state_set_remove_state (set, state_spi_to_atk (state));
>  }
>  
> 
> -
>  static CORBA_boolean
>  impl_equals (PortableServer_Servant servant,
>  	     const Accessibility_StateSet stateSet,
> @@ -228,7 +249,6 @@ impl_equals (PortableServer_Servant serv
>  }
>  
> 
> -
>  static Accessibility_StateSet
>  impl_compare (PortableServer_Servant servant,
>  	      const Accessibility_StateSet compareState,
> @@ -250,7 +270,6 @@ impl_compare (PortableServer_Servant ser
>  }
>  
> 
> -
>  static CORBA_boolean
>  impl_isEmpty (PortableServer_Servant servant,
>  	      CORBA_Environment * ev)
> @@ -262,7 +281,6 @@ impl_isEmpty (PortableServer_Servant ser
>  }
>  
> 
> -
>  static Accessibility_StateSeq *
>  impl_getStates (PortableServer_Servant servant,
>  		CORBA_Environment * ev)
> @@ -348,7 +366,6 @@ impl_getStates (PortableServer_Servant s
>    g_slist_free (states);
>    return rv;
>  }
> -
>  
> 
>  static void
> Index: libspi/stateset.h
> ===================================================================
> RCS file: /cvs/gnome/at-spi/libspi/stateset.h,v
> retrieving revision 1.3
> diff -u -p -u -r1.3 stateset.h
> --- libspi/stateset.h	13 Sep 2002 13:09:01 -0000	1.3
> +++ libspi/stateset.h	16 Dec 2002 17:45:18 -0000
> @@ -50,6 +50,21 @@ struct _SpiStateSetClass {
>  GType        spi_state_set_get_type (void);
>  SpiStateSet *spi_state_set_new      (AtkStateSet *set);
>  
> +/* private - internal API to abstract away atk API */
> +AtkStateSet *spi_atk_state_set_from_sequence  (const
> Accessibility_StateSeq *seq);
> +AtkState     spi_atk_state_from_spi_state     (Accessibility_StateType
> state);
> +#define      spi_state_set_cache_ref(s)        g_object_ref (s)
> +#define      spi_state_set_cache_unref(s)      g_object_unref (s)
> +#define      spi_state_set_cache_new(seq)     
> spi_atk_state_set_from_sequence (seq)
> +#define      spi_state_set_cache_contains(s,a)
> atk_state_set_contains_state (ATK_STATE_SET (s), \
> +									     spi_atk_state_from_spi_state (a))
> +#define      spi_state_set_cache_add(s,a)      atk_state_set_add_state
> (ATK_STATE_SET (s), \
> +									     spi_atk_state_from_spi_state (a))
> +#define      spi_state_set_cache_remove(s,a)  
> atk_state_set_remove_state (ATK_STATE_SET (s), \
> +									     spi_atk_state_from_spi_state (a))
> +#define      spi_state_set_cache_xor(a,b)      atk_state_set_xor_sets
> (ATK_STATE_SET (a), ATK_STATE_SET (b))
> +#define      spi_state_set_cache_is_empty(a)   atk_state_set_is_empty
> (ATK_STATE_SET (a))
> +
>  G_END_DECLS
>  
>  #endif /* SPI_STATE_SET_H_ */
> Index: registryd/registry.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/registryd/registry.c,v
> retrieving revision 1.57
> diff -u -p -u -r1.57 registry.c
> --- registryd/registry.c	22 Nov 2002 14:07:56 -0000	1.57
> +++ registryd/registry.c	16 Dec 2002 17:45:18 -0000
> @@ -580,9 +580,6 @@ notify_listeners_cb (GList * const *list
>  {
>    SpiListenerStruct *ls;
>    NotifyContext     *ctx = user_data;
> -#ifdef SPI_DEBUG
> -  CORBA_string       s;
> -#endif
>  
>    ls = (*list)->data;
>  
> @@ -590,23 +587,24 @@ notify_listeners_cb (GList * const *list
>    fprintf (stderr, "event quarks: %lx %lx %lx\n", ls->event_type_quark,
> ctx->etype.major, ctx->etype.minor);
>    fprintf (stderr, "event name: %s\n", ctx->etype.event_name);
>  #endif
> -
>    if ((ls->event_type_quark == ctx->etype.major) ||
>        (ls->event_type_quark == ctx->etype.minor))
>      {
>  #ifdef SPI_DEBUG
> +      CORBA_string s;
>        fprintf (stderr, "notifying listener %d\n", 0);
>  /* g_list_index (list, l->data)); */
>        s = Accessibility_Accessible__get_name (ctx->source, ctx->ev);
>        fprintf (stderr, "event source name %s\n", s);
>        CORBA_free (s);
> -#endif
> -      
> -      ctx->e_out.source = CORBA_Object_duplicate (ctx->source,
> ctx->ev);
>        if (BONOBO_EX (ctx->ev))
>          {
> +	  CORBA_exception_free (ctx->ev);
>            return SPI_RE_ENTRANT_CONTINUE;
>  	}
> +#endif
> +      
> +      ctx->e_out.source = ctx->source;
>        
>        if ((*list) && (*list)->data == ls)
>          {
> @@ -617,16 +615,11 @@ notify_listeners_cb (GList * const *list
>                DBG (1, g_warning ("Accessibility app error: exception
> during "
>  		        "event notification: %s\n",
>  		        CORBA_exception_id (ctx->ev)));
> -	      if (ctx->ev->_major == CORBA_SYSTEM_EXCEPTION)
> -		      CORBA_exception_init (ctx->ev);
> -	      /* clear system exception on notify, it means listener is dead
> but
> -	       * that's no concern of the event source :-) */
> +	      CORBA_exception_free (ctx->ev);
> +	      /* FIXME: check that this item is removed from the list
> +	       * on system exception by a 'broken' listener */
>  	    }
>  	}
> -      else /* dup re-entered */
> -        {
> -          CORBA_Object_release (ctx->e_out.source, ctx->ev);
> -	}
>      }  
>  
>    return SPI_RE_ENTRANT_CONTINUE;
> @@ -651,7 +644,6 @@ impl_registry_notify_event (PortableServ
>      {
>        ctx.ev = ev;
>        ctx.e_out = *e;
> -      CORBA_any__copy (&ctx.e_out.any_data, &e->any_data);
>        ctx.source = e->source;
>        spi_re_entrant_list_foreach (list, notify_listeners_cb, &ctx);
>      }
-- 
Bill Haneman <bill haneman sun com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]