+2002-05-02 Marc Mulcahy <marc.mulcahy@sun.com>
+
+ * libspi/accessible.c (impl_accessibility_accessible_get_role_name):
+ Fixed handling for NULL return value from ATK.
+
+ * libspi/action.c libspi/component.c libspi/editabletext.
+ libspi/hyperlink.c libspi/hypertext.c image.c libspi/selection.c
+ libspi/stateset.c libspi/table.c libspi/text.c libspi/value.c:
+ Removed redundant casts.
+
+ * libspi/table.c (impl_getSelectedRows, impl_getSelectedColumns):
+ Fixed off by one bug.
+
+ *libspi/text.c: removed impl_getRowColAtOffset (unimplemented
+ function not present in idl)
+
2002-05-02 jacob berkman <jacob@ximian.com>
* atk-bridge/Makefile.am: make atk-bridge a real module
impl_accessibility_accessible_get_role_name (PortableServer_Servant servant,
CORBA_Environment *ev)
{
+ const gchar *role_name;
AtkRole role;
AtkObject *object = get_atkobject_from_servant (servant);
role = atk_object_get_role (object);
- return CORBA_string_dup (atk_role_get_name (role));
+ role_name = atk_role_get_name (role);
+ if (role_name)
+ return CORBA_string_dup (role_name);
+ else
+ return CORBA_string_dup ("");
}
static void
CORBA_Environment *ev)
{
AtkAction *action = get_action_from_servant (servant);
- return (CORBA_long) atk_action_get_n_actions (action);
+ return atk_action_get_n_actions (action);
}
static CORBA_boolean
const CORBA_long index, CORBA_Environment * ev)
{
AtkAction *action = get_action_from_servant (servant);
- return (CORBA_boolean) atk_action_do_action (action, (gint) index);
+ return atk_action_do_action (action, (gint) index);
}
static CORBA_string
AtkAction *action = get_action_from_servant (servant);
const gchar *rv;
- rv = atk_action_get_description (action, (gint) index);
+ rv = atk_action_get_description (action, index);
if (rv)
return CORBA_string_dup (rv);
else
AtkAction *action = get_action_from_servant (servant);
const gchar *rv;
- rv = atk_action_get_name (action, (gint) index);
+ rv = atk_action_get_name (action, index);
if (rv)
return CORBA_string_dup (rv);
else
AtkAction *action = get_action_from_servant (servant);
const gchar *rv;
- rv = atk_action_get_keybinding (action, (gint) index);
+ rv = atk_action_get_keybinding (action, index);
if (rv)
return CORBA_string_dup (rv);
else
g_return_val_if_fail (component != NULL, FALSE);
- retval = atk_component_contains (component, (gint) x, (gint) y,
+ retval = atk_component_contains (component, x, y,
(AtkCoordType) coord_type);
return retval;
}
g_return_val_if_fail (component != NULL, FALSE);
child = atk_component_ref_accessible_at_point (component,
- (gint) x, (gint) y,
+ x, y,
(AtkCoordType) coord_type);
return spi_accessible_new_return (child, TRUE, ev);
}
atk_component_get_position (component, &ix, &iy,
(AtkCoordType) coord_type);
- *x = (CORBA_long) ix;
- *y = (CORBA_long) iy;
+ *x = ix;
+ *y = iy;
}
/*
g_return_if_fail (component != NULL);
atk_component_get_size (component, &iw, &ih);
- *width = (CORBA_long) iw;
- *height = (CORBA_long) ih;
+ *width = iw;
+ *height = ih;
}
static Accessibility_ComponentLayer
g_return_val_if_fail (component != NULL, -1);
- return (CORBA_short) atk_component_get_mdi_zorder (component);
+ return atk_component_get_mdi_zorder (component);
}
static CORBA_boolean
g_return_val_if_fail (editable != NULL, FALSE);
- atk_editable_text_set_text_contents (editable, (gchar *) newContents);
+ atk_editable_text_set_text_contents (editable, newContents);
return TRUE;
}
CORBA_Environment *ev)
{
AtkEditableText *editable = get_editable_text_from_servant (servant);
+ gint ip;
g_return_val_if_fail (editable != NULL, FALSE);
+ ip = position;
atk_editable_text_insert_text (editable,
- (gchar *) text,
- (gint) length,
- (gint *) &position);
+ text,
+ length,
+ &ip);
return TRUE;
}
g_return_if_fail (editable != NULL);
- atk_editable_text_copy_text (editable, (gint) startPos, (gint) endPos);
+ atk_editable_text_copy_text (editable, startPos, endPos);
}
g_return_val_if_fail (link != NULL, 0);
- return (CORBA_short) atk_hyperlink_get_n_anchors (link);
+ return atk_hyperlink_get_n_anchors (link);
}
g_return_val_if_fail (link != NULL, -1);
- return (CORBA_long) atk_hyperlink_get_start_index (link);
+ return atk_hyperlink_get_start_index (link);
}
g_return_val_if_fail (link != NULL, -1);
- return (CORBA_long) atk_hyperlink_get_end_index (link);
+ return atk_hyperlink_get_end_index (link);
}
g_return_val_if_fail (link != NULL, CORBA_string_dup (""));
- uri = atk_hyperlink_get_uri (link, (gint) i);
+ uri = atk_hyperlink_get_uri (link, i);
if (uri)
{
rv = CORBA_string_dup (uri);
g_return_val_if_fail (link != NULL, CORBA_OBJECT_NIL);
- atk_object = atk_hyperlink_get_object (link, (gint) i);
+ atk_object = atk_hyperlink_get_object (link, i);
return spi_accessible_new_return (atk_object, FALSE, ev);
}
g_return_val_if_fail (link != NULL, TRUE);
- return (CORBA_boolean) atk_hyperlink_is_valid (link);
+ return atk_hyperlink_is_valid (link);
}
g_return_val_if_fail (hypertext != NULL, 0);
- return (CORBA_long) atk_hypertext_get_n_links (hypertext);
+ return atk_hypertext_get_n_links (hypertext);
}
g_return_val_if_fail (hypertext != NULL, 0);
- return (CORBA_long)
- atk_hypertext_get_link_index (hypertext,
- (gint) characterIndex);
+ return atk_hypertext_get_link_index (hypertext,
+ characterIndex);
}
CORBA_Environment *ev)
{
AtkImage *image = get_image_from_servant (servant);
+ gint ix, iy;
g_return_if_fail (image != NULL);
atk_image_get_image_position (image,
- (gint *) x, (gint *) y,
+ &ix, &iy,
(AtkCoordType) coordType);
+ *x = ix;
+ *y = iy;
}
static void
CORBA_Environment *ev)
{
AtkImage *image = get_image_from_servant (servant);
-
+ gint iw, ih;
+
g_return_if_fail (image != NULL);
atk_image_get_image_size (image,
- (gint *) width, (gint *) height);
+ &iw, &ih);
+ *width = iw;
+ *height = ih;
}
static Accessibility_BoundingBox
gint x, y, width, height;
Accessibility_BoundingBox bbox;
+ bbox.x = bbox.y = bbox.width = bbox.height = -1;
+
image = get_image_from_servant (servant);
- atk_image_get_image_size (image, &width, &height);
- atk_image_get_image_position (image, &x, &y, coordType);
+ if (image)
+ {
+ atk_image_get_image_size (image, &width, &height);
+ atk_image_get_image_position (image, &x, &y, coordType);
- bbox.x = x;
- bbox.y = y;
- bbox.width = width;
- bbox.height = height;
+ bbox.x = x;
+ bbox.y = y;
+ bbox.width = width;
+ bbox.height = height;
+ }
return bbox;
}
g_return_val_if_fail (selection != NULL, 0);
- return (CORBA_long) atk_selection_get_selection_count (selection);
+ return atk_selection_get_selection_count (selection);
}
#endif
atk_object = atk_selection_ref_selection (selection,
- (gint) selectedChildIndex);
+ selectedChildIndex);
g_return_val_if_fail (ATK_IS_OBJECT (atk_object), CORBA_OBJECT_NIL);
g_return_val_if_fail (selection != NULL, FALSE);
- return (CORBA_boolean)
- atk_selection_remove_selection (selection, (gint) selectedChildIndex);
+ return atk_selection_remove_selection (selection, selectedChildIndex);
}
AtkStateSet *set = atk_state_set_from_servant (servant);
g_return_val_if_fail (set, FALSE);
- return (CORBA_boolean)
- atk_state_set_contains_state (set, atk_state_types[state]);
+ return atk_state_set_contains_state (set, atk_state_types[state]);
}
g_object_unref (G_OBJECT(set2));
if (return_set)
{
- rv = (CORBA_boolean)
- atk_state_set_is_empty (return_set);
+ rv = atk_state_set_is_empty (return_set);
g_object_unref (G_OBJECT(return_set));
}
else
AtkStateSet *set = atk_state_set_from_servant (servant);
g_return_val_if_fail (set, TRUE);
- return (CORBA_boolean)
- atk_state_set_is_empty (set);
+ return atk_state_set_is_empty (set);
}
g_return_val_if_fail (table != NULL, 0);
- return (CORBA_long) atk_table_get_n_rows (table);
+ return atk_table_get_n_rows (table);
}
g_return_val_if_fail (table != NULL, 0);
- return (CORBA_long) atk_table_get_n_columns (table);
+ return atk_table_get_n_columns (table);
}
bonobo_return_val_if_fail (length > 0, NULL, ev);
retval = Accessibility_LongSeq__alloc ();
- retval->_maximum = retval->_length = (CORBA_long) length;
+ retval->_maximum = retval->_length = length;
retval->_buffer = Accessibility_LongSeq_allocbuf (length);
- while (--length)
+ while (--length >= 0)
{
- retval->_buffer[length] = (CORBA_long) selectedRows[length];
+ retval->_buffer[length] = selectedRows[length];
}
- g_free ((gpointer) selectedRows);
+ g_free (selectedRows);
return retval;
}
bonobo_return_val_if_fail (length >= 0, NULL, ev);
retval = Accessibility_LongSeq__alloc ();
- retval->_maximum = retval->_length = (CORBA_long) length;
+ retval->_maximum = retval->_length = length;
retval->_buffer = Accessibility_LongSeq_allocbuf (length);
- while (--length)
+ while (--length >= 0)
{
retval->_buffer[length] = (CORBA_long) selectedColumns[length];
}
- g_free ((gpointer) selectedColumns);
+ g_free (selectedColumns);
return retval;
}
g_return_val_if_fail (text != NULL, CORBA_string_dup (""));
- txt = atk_text_get_text (text, (gint) startOffset, (gint) endOffset);
+ txt = atk_text_get_text (text, startOffset, endOffset);
if (txt)
{
rv = CORBA_string_dup (txt);
g_return_val_if_fail (text != NULL, CORBA_string_dup (""));
txt = atk_text_get_text_after_offset (text,
- (gint) offset, (AtkTextBoundary) type,
+ offset, (AtkTextBoundary) type,
&intStartOffset, &intEndOffset);
- *startOffset = (CORBA_long) intStartOffset;
- *endOffset = (CORBA_long) intEndOffset;
+ *startOffset = intStartOffset;
+ *endOffset = intEndOffset;
if (txt)
{
CORBA_long * endOffset,
CORBA_Environment *ev)
{
- CORBA_char *txt;
+ gchar *txt;
CORBA_char *rv;
gint intStartOffset, intEndOffset;
AtkText *text = get_text_from_servant (servant);
g_return_val_if_fail (text != NULL, CORBA_string_dup (""));
- txt = (CORBA_char *) atk_text_get_text_at_offset (
+ txt = atk_text_get_text_at_offset (
text,
- (gint) offset, (AtkTextBoundary) type,
+ offset, (AtkTextBoundary) type,
&intStartOffset, &intEndOffset);
- *startOffset = (CORBA_long) intStartOffset;
- *endOffset = (CORBA_long) intEndOffset;
+ *startOffset = intStartOffset;
+ *endOffset = intEndOffset;
if (txt)
{
g_return_val_if_fail (text != NULL, 0);
- return (CORBA_unsigned_long)
- atk_text_get_character_at_offset (text, (gint) offset);
+ return atk_text_get_character_at_offset (text, offset);
}
g_return_val_if_fail (text != NULL, CORBA_string_dup (""));
txt = atk_text_get_text_before_offset (text,
- (gint) offset, (AtkTextBoundary) type,
+ offset, (AtkTextBoundary) type,
&intStartOffset, &intEndOffset);
- *startOffset = (CORBA_long) intStartOffset;
- *endOffset = (CORBA_long) intEndOffset;
+ *startOffset = intStartOffset;
+ *endOffset = intEndOffset;
if (txt)
{
g_return_val_if_fail (text != NULL, -1);
- return (CORBA_long) atk_text_get_caret_offset (text);
+ return atk_text_get_caret_offset (text);
}
set = atk_text_get_run_attributes (text, offset,
&intstart_offset, &intend_offset);
- *startOffset = (CORBA_long) intstart_offset;
- *endOffset = (CORBA_long) intend_offset;
+ *startOffset = intstart_offset;
+ *endOffset = intend_offset;
rv = _string_from_attribute_set (set);
atk_attribute_set_free (set);
return rv;
CORBA_Environment *ev)
{
AtkText *text = get_text_from_servant (servant);
+ gint ix, iy, iw, ih;
g_return_if_fail (text != NULL);
- /* FIXME: Casting a CORBA_long to a gint * is inherantly risky */
atk_text_get_character_extents (
- text, (gint) offset,
- (gint *) x, (gint *) y, (gint *) width, (gint *) height,
+ text, offset,
+ &ix, &iy, &iw, &ih,
(AtkCoordType) coordType);
+ *x = ix;
+ *y = iy;
+ *width = iw;
+ *height = ih;
}
impl__get_characterCount (PortableServer_Servant servant,
CORBA_Environment *ev)
{
- CORBA_long retval;
AtkText *text = get_text_from_servant (servant);
g_return_val_if_fail (text != NULL, 0);
- retval = (CORBA_long) atk_text_get_character_count (text);
-
- return retval;
+ return atk_text_get_character_count (text);
}
g_return_val_if_fail (text != NULL, -1);
- return (CORBA_long)
- atk_text_get_offset_at_point (text,
- (gint) x, (gint) y,
+ return atk_text_get_offset_at_point (text,
+ x, y,
(AtkCoordType) coordType);
}
g_return_val_if_fail (text != NULL, 0);
- return (CORBA_long) atk_text_get_n_selections (text);
+ return atk_text_get_n_selections (text);
}
CORBA_Environment *ev)
{
AtkText *text = get_text_from_servant (servant);
-
+ gint intStartOffset, intEndOffset;
+
g_return_if_fail (text != NULL);
- atk_text_get_selection (text, (gint) selectionNum,
- (gint *) startOffset, (gint *) endOffset);
+ atk_text_get_selection (text, selectionNum,
+ &intStartOffset, &intEndOffset);
+ *startOffset = intStartOffset;
+ *endOffset = intEndOffset;
}
g_return_val_if_fail (text != NULL, FALSE);
- return (CORBA_boolean)
- atk_text_add_selection (text,
- (gint) startOffset, (gint) endOffset);
+ return atk_text_add_selection (text,
+ startOffset, endOffset);
}
g_return_val_if_fail (text != NULL, FALSE);
- return (CORBA_boolean)
- atk_text_remove_selection (text, (gint) selectionNum);
+ return atk_text_remove_selection (text, selectionNum);
}
g_return_val_if_fail (text != NULL, FALSE);
- return (CORBA_boolean)
- atk_text_set_selection (text,
- (gint) selectionNum, (gint) startOffset, (gint) endOffset);
+ return atk_text_set_selection (text,
+ selectionNum, startOffset, endOffset);
}
g_return_val_if_fail (text != NULL, FALSE);
- return (CORBA_boolean)
- atk_text_set_caret_offset (text, (gint) value);
-}
-
-
-static void
-impl_getRowColAtOffset (PortableServer_Servant servant,
- const CORBA_long offset, CORBA_long * row,
- CORBA_long * column, CORBA_Environment *ev)
-{
- AtkText *text = get_text_from_servant (servant);
-
- g_return_if_fail (text != NULL);
-
- g_print ("getRowColAtOffset not yet implemented\n");
+ return atk_text_set_caret_offset (text, value);
}
static void