From: marcm Date: Fri, 3 May 2002 22:55:34 +0000 (+0000) Subject: 2002-05-02 Marc Mulcahy X-Git-Tag: AT_SPI2_CORE_0_1_3~915 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd63b7a22916da23b5d8aea4e266f25a4b4b68fb;p=platform%2Fupstream%2Fat-spi2-core.git 2002-05-02 Marc Mulcahy * 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) git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@288 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- diff --git a/ChangeLog b/ChangeLog index 44197ca..4ad59a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2002-05-02 Marc Mulcahy + + * 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 * atk-bridge/Makefile.am: make atk-bridge a real module diff --git a/libspi/accessible.c b/libspi/accessible.c index f83263e..aaa6806 100644 --- a/libspi/accessible.c +++ b/libspi/accessible.c @@ -384,6 +384,7 @@ static CORBA_char * 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); @@ -391,7 +392,11 @@ impl_accessibility_accessible_get_role_name (PortableServer_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 diff --git a/libspi/action.c b/libspi/action.c index d0352c5..594a3c8 100644 --- a/libspi/action.c +++ b/libspi/action.c @@ -102,7 +102,7 @@ impl__get_nActions (PortableServer_Servant servant, 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 @@ -110,7 +110,7 @@ impl_doAction (PortableServer_Servant servant, 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 @@ -121,7 +121,7 @@ impl_getDescription (PortableServer_Servant servant, 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 @@ -136,7 +136,7 @@ impl_getName (PortableServer_Servant servant, 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 @@ -151,7 +151,7 @@ impl_getKeyBinding (PortableServer_Servant servant, 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 diff --git a/libspi/component.c b/libspi/component.c index 1e60da4..5c5fc0d 100644 --- a/libspi/component.c +++ b/libspi/component.c @@ -57,7 +57,7 @@ impl_accessibility_component_contains (PortableServer_Servant servant, 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; } @@ -78,7 +78,7 @@ impl_accessibility_component_get_accessible_at_point (PortableServer_Servant ser 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); } @@ -123,8 +123,8 @@ impl_accessibility_component_get_position (PortableServer_Servant servant, atk_component_get_position (component, &ix, &iy, (AtkCoordType) coord_type); - *x = (CORBA_long) ix; - *y = (CORBA_long) iy; + *x = ix; + *y = iy; } /* @@ -142,8 +142,8 @@ impl_accessibility_component_get_size (PortableServer_Servant servant, 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 @@ -184,7 +184,7 @@ impl_accessibility_component_get_mdi_z_order (PortableServer_Servant servant, 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 diff --git a/libspi/editabletext.c b/libspi/editabletext.c index fb6f7ad..4c85d17 100644 --- a/libspi/editabletext.c +++ b/libspi/editabletext.c @@ -142,7 +142,7 @@ impl_setTextContents (PortableServer_Servant servant, 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; } @@ -156,13 +156,15 @@ impl_insertText (PortableServer_Servant servant, 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; } @@ -176,7 +178,7 @@ impl_copyText (PortableServer_Servant servant, g_return_if_fail (editable != NULL); - atk_editable_text_copy_text (editable, (gint) startPos, (gint) endPos); + atk_editable_text_copy_text (editable, startPos, endPos); } diff --git a/libspi/hyperlink.c b/libspi/hyperlink.c index d11ca0e..0833517 100644 --- a/libspi/hyperlink.c +++ b/libspi/hyperlink.c @@ -113,7 +113,7 @@ impl__get_n_anchors (PortableServer_Servant servant, g_return_val_if_fail (link != NULL, 0); - return (CORBA_short) atk_hyperlink_get_n_anchors (link); + return atk_hyperlink_get_n_anchors (link); } @@ -125,7 +125,7 @@ impl__get_startIndex (PortableServer_Servant servant, g_return_val_if_fail (link != NULL, -1); - return (CORBA_long) atk_hyperlink_get_start_index (link); + return atk_hyperlink_get_start_index (link); } @@ -137,7 +137,7 @@ impl__get_endIndex (PortableServer_Servant servant, g_return_val_if_fail (link != NULL, -1); - return (CORBA_long) atk_hyperlink_get_end_index (link); + return atk_hyperlink_get_end_index (link); } @@ -151,7 +151,7 @@ impl_getURI (PortableServer_Servant servant, 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); @@ -174,7 +174,7 @@ impl_getObject (PortableServer_Servant servant, 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); } @@ -188,6 +188,6 @@ impl_isValid (PortableServer_Servant servant, g_return_val_if_fail (link != NULL, TRUE); - return (CORBA_boolean) atk_hyperlink_is_valid (link); + return atk_hyperlink_is_valid (link); } diff --git a/libspi/hypertext.c b/libspi/hypertext.c index c186135..11477d6 100644 --- a/libspi/hypertext.c +++ b/libspi/hypertext.c @@ -60,7 +60,7 @@ impl_getNLinks (PortableServer_Servant servant, g_return_val_if_fail (hypertext != NULL, 0); - return (CORBA_long) atk_hypertext_get_n_links (hypertext); + return atk_hypertext_get_n_links (hypertext); } @@ -93,9 +93,8 @@ impl_getLinkIndex (PortableServer_Servant servant, 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); } diff --git a/libspi/image.c b/libspi/image.c index 8a30cb7..cfa0586 100644 --- a/libspi/image.c +++ b/libspi/image.c @@ -54,12 +54,15 @@ impl_getImagePosition (PortableServer_Servant servant, 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 @@ -68,11 +71,14 @@ impl_getImageSize (PortableServer_Servant servant, 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 @@ -84,15 +90,20 @@ impl_getImageExtents (PortableServer_Servant servant, 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; } diff --git a/libspi/selection.c b/libspi/selection.c index 8ef4cb0..f6cf3b6 100644 --- a/libspi/selection.c +++ b/libspi/selection.c @@ -58,7 +58,7 @@ impl__get_nSelectedChildren (PortableServer_Servant servant, g_return_val_if_fail (selection != NULL, 0); - return (CORBA_long) atk_selection_get_selection_count (selection); + return atk_selection_get_selection_count (selection); } @@ -77,7 +77,7 @@ impl_getSelectedChild (PortableServer_Servant servant, #endif atk_object = atk_selection_ref_selection (selection, - (gint) selectedChildIndex); + selectedChildIndex); g_return_val_if_fail (ATK_IS_OBJECT (atk_object), CORBA_OBJECT_NIL); @@ -112,8 +112,7 @@ impl_deselectSelectedChild (PortableServer_Servant servant, 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); } diff --git a/libspi/stateset.c b/libspi/stateset.c index 6f66667..645e552 100644 --- a/libspi/stateset.c +++ b/libspi/stateset.c @@ -167,8 +167,7 @@ impl_contains (PortableServer_Servant servant, 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]); } @@ -217,8 +216,7 @@ impl_equals (PortableServer_Servant servant, 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 @@ -257,8 +255,7 @@ impl_isEmpty (PortableServer_Servant servant, 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); } diff --git a/libspi/table.c b/libspi/table.c index d0df142..629a75c 100644 --- a/libspi/table.c +++ b/libspi/table.c @@ -90,7 +90,7 @@ impl__get_nRows (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, 0); - return (CORBA_long) atk_table_get_n_rows (table); + return atk_table_get_n_rows (table); } @@ -102,7 +102,7 @@ impl__get_nColumns (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, 0); - return (CORBA_long) atk_table_get_n_columns (table); + return atk_table_get_n_columns (table); } @@ -285,15 +285,15 @@ impl_getSelectedRows (PortableServer_Servant servant, 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; } @@ -315,15 +315,15 @@ impl_getSelectedColumns (PortableServer_Servant servant, 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; } diff --git a/libspi/text.c b/libspi/text.c index 6e27460..9c5f85b 100644 --- a/libspi/text.c +++ b/libspi/text.c @@ -53,7 +53,7 @@ impl_getText (PortableServer_Servant servant, 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); @@ -83,10 +83,10 @@ impl_getTextAfterOffset (PortableServer_Servant servant, 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) { @@ -108,20 +108,20 @@ impl_getTextAtOffset (PortableServer_Servant servant, 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) { @@ -144,8 +144,7 @@ impl_getCharacterAtOffset (PortableServer_Servant servant, 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); } @@ -166,11 +165,11 @@ impl_getTextBeforeOffset (PortableServer_Servant servant, 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) { @@ -192,7 +191,7 @@ impl__get_caretOffset (PortableServer_Servant servant, g_return_val_if_fail (text != NULL, -1); - return (CORBA_long) atk_text_get_caret_offset (text); + return atk_text_get_caret_offset (text); } @@ -242,8 +241,8 @@ impl_getAttributes (PortableServer_Servant servant, 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; @@ -259,14 +258,18 @@ impl_getCharacterExtents (PortableServer_Servant servant, 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; } @@ -274,14 +277,11 @@ static CORBA_long 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); } @@ -295,9 +295,8 @@ impl_getOffsetAtPoint (PortableServer_Servant servant, 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); } @@ -310,7 +309,7 @@ impl_getNSelections (PortableServer_Servant servant, g_return_val_if_fail (text != NULL, 0); - return (CORBA_long) atk_text_get_n_selections (text); + return atk_text_get_n_selections (text); } @@ -321,11 +320,14 @@ impl_getSelection (PortableServer_Servant servant, 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; } @@ -339,9 +341,8 @@ impl_addSelection (PortableServer_Servant servant, 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); } @@ -354,8 +355,7 @@ impl_removeSelection (PortableServer_Servant servant, 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); } @@ -370,9 +370,8 @@ impl_setSelection (PortableServer_Servant servant, 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); } @@ -385,21 +384,7 @@ impl_setCaretOffset (PortableServer_Servant servant, 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