+2001-12-04 Bill Haneman <bill.haneman@sun.com>
+
+ * libspi/registry.c (_registry_notify_listeners):
+ Changed listener loop iteration to use preferred convention.
+ Got rid of string memory leaks caused be calling g_strconcat
+ inside function calls.
+
+ * libspi/registry.c (parse_event_type):
+ Stopped g_strconcat memory leaks, free the g_strsplit return,
+ g_strdup the split pieces when used, etc.
+
+2001-12-04 Bill Haneman <bill.haneman@sun.com>
+
+ * idl/State.idl:
+ Change method 'compare' to return a 'difference set' rather than
+ taking a StateSet as an out parameter (more Java-friendly).
+
+ * idl/Accessible.idl:
+ Added CORBA struct 'BoundingBox', to faciliate API changes below:
+
+ * idl/Component.idl:
+ * idl/Image.idl:
+ Changed methods 'getExtents' and 'getImageExtents' in these
+ interfaces to return a BoundingBox structure.
+ (getPosition and getSize are redundant and possibly should be
+ removed, rather than creating a corresponding Point struct.)
+
+ * cspi/spi_component.c:
+ Modify implementation of getExtents to reflect the above IDL
+ change.
+
+ * cspi/spi_image.c:
+ * cspi/spi.h:
+ Add (missing) AccessibleImage_getExtents () API.
+
+ * docs/reference/cspi/at-spi-cspi-sections.txt:
+ Added AccessibleImage_getImageExtents () to docs.
+
2001-12-03 Bill Haneman <bill.haneman@sun.com>
* idl/Component.idl:
long int *y,
AccessibleCoordType ctype);
+void
+AccessibleImage_getImageExtents (AccessibleImage *obj,
+ long int *x,
+ long int *y,
+ long int *width,
+ long int *height,
+ AccessibleCoordType ctype);
/*
*
* AccessibleRelation function prototypes
long int *height,
AccessibleCoordType ctype)
{
- CORBA_long cx, cy, cw, ch;
- Accessibility_Component_getExtents (CSPI_OBJREF (obj),
- &cx,
- &cy,
- &cw,
- &ch,
- ctype,
- cspi_ev ());
+ Accessibility_BoundingBox bbox;
+ bbox = Accessibility_Component_getExtents (CSPI_OBJREF (obj),
+ ctype,
+ cspi_ev ());
cspi_warn_ev (cspi_ev (), "AccessibleComponent_getExtents");
- *x = (long) cx;
- *y = (long) cy;
- *width = (long) cw;
- *height = (long) ch;
+ *x = bbox.x;
+ *y = bbox.y;
+ *width = bbox.width;
+ *height = bbox.height;
}
/**
(CORBA_long *) x, (CORBA_long *) y, (CORBA_short) ctype,
cspi_ev ());
}
+
+/**
+ * AccessibleImage_getImageExtents:
+ * @obj: a pointer to the #AccessibleImage implementor to query.
+ * @x: a pointer to a #long into which the minimum x coordinate will be returned.
+ * @y: a pointer to a #long into which the minimum y coordinate will be returned.
+ * @width: a pointer to a #long into which the image x extent will be returned.
+ * @width: a pointer to a #long into which the image y extent will be returned.
+ * @ctype: the desired coordinate system into which to return the results,
+ * (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
+ *
+ * Get the bounding box of the image displayed in a
+ * specified #AccessibleImage implementor.
+ *
+ **/
+void
+AccessibleImage_getImageExtents (AccessibleImage *obj,
+ long *x,
+ long *y,
+ long *width,
+ long *height,
+ AccessibleCoordType ctype)
+{
+ Accessibility_BoundingBox bbox;
+ bbox = Accessibility_Image_getImageExtents (CSPI_OBJREF (obj),
+ (CORBA_short) ctype,
+ cspi_ev ());
+ *x = bbox.x;
+ *y = bbox.y;
+ *width = bbox.width;
+ *height = bbox.height;
+}
AccessibleImage_getImageDescription
AccessibleImage_getImageSize
AccessibleImage_getImagePosition
+AccessibleImage_getImageExtents
</SECTION>
<SECTION>
typedef sequence<Relation> RelationSet;
+ struct BoundingBox {
+ long x;
+ long y;
+ long width;
+ long height;
+ };
+
interface Accessible : Bonobo::Unknown {
/**
boolean contains (in long x, in long y, in short coord_type);
Accessible getAccessibleAtPoint (in long x, in long y, in short coord_type);
- void getExtents (out long x, out long y, out long width, out long height, in short coord_type);
+ BoundingBox getExtents (in short coord_type);
void getPosition (out long x, out long y, in short coord_type);
void getSize (out long width, out long height);
ComponentLayer getLayer ();
interface Image : Bonobo::Unknown {
readonly attribute string imageDescription;
+ BoundingBox getImageExtents (in short coordType);
void getImagePosition (out long x, out long y, in short coordType);
- void getImageExtents (out long x, out long y, out long width, out long height, in short coodrType);
void getImageSize (out long width, out long height);
};
};
void add (in StateType state);
void remove (in StateType state);
boolean equals (in StateSet stateSet);
- void compare (in StateSet compareState, out StateSet differenceSet);
+ /* returns a 'difference set' */
+ StateSet compare (in StateSet compareState);
boolean isEmpty ();
};
};
typedef sequence<Relation> RelationSet;
+ struct BoundingBox {
+ long x;
+ long y;
+ long width;
+ long height;
+ };
+
interface Accessible : Bonobo::Unknown {
/**
boolean contains (in long x, in long y, in short coord_type);
Accessible getAccessibleAtPoint (in long x, in long y, in short coord_type);
- void getExtents (out long x, out long y, out long width, out long height, in short coord_type);
+ BoundingBox getExtents (in short coord_type);
void getPosition (out long x, out long y, in short coord_type);
void getSize (out long width, out long height);
ComponentLayer getLayer ();
interface Image : Bonobo::Unknown {
readonly attribute string imageDescription;
+ BoundingBox getImageExtents (in short coordType);
void getImagePosition (out long x, out long y, in short coordType);
- void getImageExtents (out long x, out long y, out long width, out long height, in short coodrType);
void getImageSize (out long width, out long height);
};
};
void add (in StateType state);
void remove (in StateType state);
boolean equals (in StateSet stateSet);
- void compare (in StateSet compareState, out StateSet differenceSet);
+ /* returns a 'difference set' */
+ StateSet compare (in StateSet compareState);
boolean isEmpty ();
};
};
static gboolean _device_event_controller_hook (gpointer source);
SpiListenerStruct *
-spi_listener_struct_new (Accessibility_EventListener *listener, CORBA_Environment *ev)
+spi_listener_struct_new (Accessibility_EventListener listener, CORBA_Environment *ev)
{
SpiListenerStruct *retval = g_malloc (sizeof (SpiListenerStruct));
retval->listener = bonobo_object_dup_ref (listener, ev);
parse_event_type (EventTypeStruct *etype, char *event_name)
{
gchar **split_string;
+ gchar *s;
split_string = g_strsplit(event_name, ":", 4);
etype->event_name = g_strndup(event_name, 255);
if (split_string[1])
{
- etype->major = split_string[1];
+ etype->major = g_strdup (split_string[1]);
if (split_string[2])
{
- etype->minor = split_string[2];
+ etype->minor = g_strdup (split_string[2]);
if (split_string[3])
{
- etype->detail = split_string[3];
- etype->hash = g_str_hash ( g_strconcat (split_string[1], split_string[2], split_string[3], NULL));
+ etype->detail = g_strdup (split_string[3]);
+ s = g_strconcat (split_string[1], split_string[2], split_string[3], NULL);
+ etype->hash = g_str_hash (s);
+ g_free (s);
}
else
{
etype->detail = g_strdup ("");
- etype->hash = g_str_hash ( g_strconcat (split_string[1], split_string[2], NULL));
+ s = g_strconcat (split_string[1], split_string[2], NULL);
+ etype->hash = g_str_hash (s);
+ g_free (s);
}
}
else
etype->hash = g_str_hash ("");
}
- /* TODO: don't forget to free the strings from caller when done ! */
+ g_strfreev (split_string);
}
/**
const Accessibility_Event *e_in,
CORBA_Environment *ev)
{
- int n;
- int len;
+ gint n = 0;
SpiListenerStruct *ls;
+ GList *list;
EventTypeStruct etype;
Accessibility_Event *e_out;
+ gchar *s;
guint minor_hash;
parse_event_type (&etype, e_in->type);
- minor_hash = g_str_hash (g_strconcat (etype.major, etype.minor, NULL));
- len = g_list_length (listeners);
+ s = g_strconcat (etype.major, etype.minor, NULL);
+ minor_hash = g_str_hash (s);
+ g_free (s);
- for (n=0; n<len; ++n)
+ for (list = listeners; list; list = list->next)
{
- ls = (SpiListenerStruct *) g_list_nth_data (listeners, n);
+ ls = (SpiListenerStruct *) list->data;
#ifdef SPI_SPI_LISTENER_DEBUG
fprintf(stderr, "event hashes: %lx %lx %lx\n", ls->event_type_hash, etype.hash, minor_hash);
fprintf(stderr, "event name: %s\n", etype.event_name);
if ((ls->event_type_hash == etype.hash) || (ls->event_type_hash == minor_hash))
{
#ifdef SPI_DEBUG
- fprintf(stderr, "notifying listener #%d\n", n);
- fprintf(stderr, "event source name %s\n", Accessibility_Accessible__get_name(e_in->source, ev));
+ fprintf(stderr, "notifying listener #%d\n", n++);
+ s = Accessibility_Accessible__get_name(e_in->source, ev);
+ fprintf(stderr, "event source name %s\n", s);
+ g_free (s);
#endif
e_out = ORBit_copy_value (e_in, TC_Accessibility_Event);
e_out->source = bonobo_object_dup_ref (e_in->source, ev);
static gboolean _device_event_controller_hook (gpointer source);
SpiListenerStruct *
-spi_listener_struct_new (Accessibility_EventListener *listener, CORBA_Environment *ev)
+spi_listener_struct_new (Accessibility_EventListener listener, CORBA_Environment *ev)
{
SpiListenerStruct *retval = g_malloc (sizeof (SpiListenerStruct));
retval->listener = bonobo_object_dup_ref (listener, ev);
parse_event_type (EventTypeStruct *etype, char *event_name)
{
gchar **split_string;
+ gchar *s;
split_string = g_strsplit(event_name, ":", 4);
etype->event_name = g_strndup(event_name, 255);
if (split_string[1])
{
- etype->major = split_string[1];
+ etype->major = g_strdup (split_string[1]);
if (split_string[2])
{
- etype->minor = split_string[2];
+ etype->minor = g_strdup (split_string[2]);
if (split_string[3])
{
- etype->detail = split_string[3];
- etype->hash = g_str_hash ( g_strconcat (split_string[1], split_string[2], split_string[3], NULL));
+ etype->detail = g_strdup (split_string[3]);
+ s = g_strconcat (split_string[1], split_string[2], split_string[3], NULL);
+ etype->hash = g_str_hash (s);
+ g_free (s);
}
else
{
etype->detail = g_strdup ("");
- etype->hash = g_str_hash ( g_strconcat (split_string[1], split_string[2], NULL));
+ s = g_strconcat (split_string[1], split_string[2], NULL);
+ etype->hash = g_str_hash (s);
+ g_free (s);
}
}
else
etype->hash = g_str_hash ("");
}
- /* TODO: don't forget to free the strings from caller when done ! */
+ g_strfreev (split_string);
}
/**
const Accessibility_Event *e_in,
CORBA_Environment *ev)
{
- int n;
- int len;
+ gint n = 0;
SpiListenerStruct *ls;
+ GList *list;
EventTypeStruct etype;
Accessibility_Event *e_out;
+ gchar *s;
guint minor_hash;
parse_event_type (&etype, e_in->type);
- minor_hash = g_str_hash (g_strconcat (etype.major, etype.minor, NULL));
- len = g_list_length (listeners);
+ s = g_strconcat (etype.major, etype.minor, NULL);
+ minor_hash = g_str_hash (s);
+ g_free (s);
- for (n=0; n<len; ++n)
+ for (list = listeners; list; list = list->next)
{
- ls = (SpiListenerStruct *) g_list_nth_data (listeners, n);
+ ls = (SpiListenerStruct *) list->data;
#ifdef SPI_SPI_LISTENER_DEBUG
fprintf(stderr, "event hashes: %lx %lx %lx\n", ls->event_type_hash, etype.hash, minor_hash);
fprintf(stderr, "event name: %s\n", etype.event_name);
if ((ls->event_type_hash == etype.hash) || (ls->event_type_hash == minor_hash))
{
#ifdef SPI_DEBUG
- fprintf(stderr, "notifying listener #%d\n", n);
- fprintf(stderr, "event source name %s\n", Accessibility_Accessible__get_name(e_in->source, ev));
+ fprintf(stderr, "notifying listener #%d\n", n++);
+ s = Accessibility_Accessible__get_name(e_in->source, ev);
+ fprintf(stderr, "event source name %s\n", s);
+ g_free (s);
#endif
e_out = ORBit_copy_value (e_in, TC_Accessibility_Event);
e_out->source = bonobo_object_dup_ref (e_in->source, ev);