* 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.
git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@385
e2bd861d-eb25-0410-b326-
f6ed22b6b98c
+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).
+Optimisation:
+ + async unref's ...
+ + cache Role & queryInterface results ... [!]
+
2.0.0:
+ fix bug #82509 which prevents return of boolean FALSE from
#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;
}
static Accessibility_Registry
-spi_atk_bridge_get_registry ()
+spi_atk_bridge_get_registry (void)
{
CORBA_Environment ev;
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[])
{
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);
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);
}
{
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;
}
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;
guint ref_count : 30;
};
+struct _AccessibleStateSet {
+ guint ref_count;
+ GArray *states;
+};
+
#define SPI_INTERNAL_EVENT_MAGIC 0xc3
/*
* For internal use by CSPI implementation only
*/
#include <stdlib.h> /* for malloc */
+#include <libspi/stateset.h>
#include <cspi/spi-private.h>
static const char *role_names [] =
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.
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 = spi_state_set_cache_new (corba_seq);
+
+ CORBA_free (corba_seq);
+ cspi_release_unref (corba_stateset);
+
return retval;
}
void
AccessibleStateSet_ref (AccessibleStateSet *obj)
{
- cspi_object_ref (obj);
+ spi_state_set_cache_ref (obj);
}
/**
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.
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));
}
/**
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));
}
/**
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));
}
/**
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;
}
/**
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 spi_state_set_cache_xor (obj, obj2);
}
/**
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);
}
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);
CORBA_Environment *
cspi_ev (void)
{
+ CORBA_exception_init (&ev);
return &ev;
}
{
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;
AccessibleKeyEventMask eventmask,
AccessibleKeyListenerSyncType sync_type)
{
- gint i, mask;
+ gint i;
Accessibility_KeySet key_set;
Accessibility_KeyEventTypeSeq key_events;
Accessibility_ControllerEventMask controller_event_mask;
SPIBoolean retval = FALSE;
Accessibility_EventTypeSeq event_types;
Accessibility_EventType event_type_buffer[2];
- gint i, mask;
+ gint i;
if (!listener)
{
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];
return Accessibility_TEXT_BOUNDARY_CHAR;
break;
}
+ /* FIXME */
+ return Accessibility_TEXT_BOUNDARY_CHAR;
}
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)
return ATK_STATE_SET(base->gobj);
}
+AtkStateSet *
+spi_state_set_cache_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_state_set_cache_from_sequence (seq);
CORBA_free (seq);
- g_free (states);
+
return rv;
}
-
SpiStateSet *
spi_state_set_new (AtkStateSet *obj)
{
}
-
static CORBA_boolean
impl_contains (PortableServer_Servant servant,
const Accessibility_StateType state,
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,
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,
}
-
static Accessibility_StateSet
impl_compare (PortableServer_Servant servant,
const Accessibility_StateSet compareState,
}
-
static CORBA_boolean
impl_isEmpty (PortableServer_Servant servant,
CORBA_Environment * ev)
}
-
static Accessibility_StateSeq *
impl_getStates (PortableServer_Servant servant,
CORBA_Environment * ev)
}
-
static void
spi_state_set_class_init (SpiStateSetClass *klass)
{
GType spi_state_set_get_type (void);
SpiStateSet *spi_state_set_new (AtkStateSet *set);
+/* private - internal API to abstract away atk API */
+AtkStateSet *spi_state_set_cache_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_state_set_cache_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_ */
{
SpiListenerStruct *ls;
NotifyContext *ctx = user_data;
-#ifdef SPI_DEBUG
- CORBA_string s;
-#endif
ls = (*list)->data;
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)
{
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;
{
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);
}