From: billh Date: Mon, 15 Apr 2002 16:03:30 +0000 (+0000) Subject: Added boolean return types for methods in Component, Selection, X-Git-Tag: AT_SPI2_CORE_0_1_3~930 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a90cc5cacb5efd233b714287297034c079def8aa;p=platform%2Fupstream%2Fat-spi2-core.git Added boolean return types for methods in Component, Selection, and EditableText; those in Component and Selection now match ATK, and others match the cspi signatures already present. Added implementation for AccessibleComponent_grabFocus. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@270 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- diff --git a/ChangeLog b/ChangeLog index ceda004..2cd9f5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +2002-04-15 Bill Haneman + + * configure.in: + Revved version to 0.11. + + * libspi/component.c: + Added implementation for grabFocus. + + * idl/Accessibility_Component.idl + (Accessibility_Component_grabFocus): + Made this method return boolean to indicate success or failure, to + be consistent with cspi and the corresponding ATK method. + + * idl/Accessibility_Selection.idl + (Accessibility_Selection_selectAll) : + Made these methods return boolean to indicate success or + failure, to be consistent with cspi and the corresponding ATK methods. + + * idl/Accessibility_EditableText.idl + (Accessibility_EditableText_setTextContents, + Accessibility_EditableText_insertText, + Accessibility_EditableText_cutText, + Accessibility_EditableText_deleteText, + Accessibility_EditableText_pasteText): + Made these methods return boolean to indicate + success or failure. + + * cspi/spi_editabletext.c: + Made these methods return booleans. + + * libspi/selection.c: + * libspi/component.c: + * libspi/editabletext.c: + Connected the boolean returns from ATK + to the server-side code referenced above. + 2002-04-14 Bill Haneman * idl/Accessibility_Table.idl: Added missing methods, diff --git a/configure.in b/configure.in index 4011ab3..0236f30 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ AC_INIT(idl/Accessibility.idl) AT_SPI_MAJOR_VERSION=0 -AT_SPI_MINOR_VERSION=10 +AT_SPI_MINOR_VERSION=11 AT_SPI_MICRO_VERSION=0 AT_SPI_INTERFACE_AGE=0 AT_SPI_BINARY_AGE=0 diff --git a/cspi/spi.h b/cspi/spi.h index 4afe11e..5deb744 100644 --- a/cspi/spi.h +++ b/cspi/spi.h @@ -305,7 +305,7 @@ void AccessibleComponent_getSize (AccessibleComponent *obj, long int *height); AccessibleComponentLayer AccessibleComponent_getLayer (AccessibleComponent *obj); -void AccessibleComponent_grabFocus (AccessibleComponent *obj); +SPIBoolean AccessibleComponent_grabFocus (AccessibleComponent *obj); short AccessibleComponent_getMDIZOrder(AccessibleComponent *obj); /* AccessibleEditableText function prototypes */ @@ -486,7 +486,7 @@ AccessibleSelection_isChildSelected (AccessibleSelection *obj, SPIBoolean AccessibleSelection_selectAll (AccessibleSelection *obj); -void +SPIBoolean AccessibleSelection_clearSelection (AccessibleSelection *obj); diff --git a/cspi/spi_component.c b/cspi/spi_component.c index 8e746e4..cf43b7d 100644 --- a/cspi/spi_component.c +++ b/cspi/spi_component.c @@ -273,8 +273,22 @@ AccessibleComponent_getMDIZOrder (AccessibleComponent *obj) * * Attempt to set the keyboard input focus to the specified * #AccessibleComponent. + * + * Returns: #TRUE if successful, #FALSE otherwise. + * **/ -void +SPIBoolean AccessibleComponent_grabFocus (AccessibleComponent *obj) { + short retval; + + cspi_return_val_if_fail (obj != NULL, FALSE); + + retval = Accessibility_Component_grabFocus (CSPI_OBJREF (obj), + cspi_ev ()); + + cspi_return_val_if_ev ("grabFocus", FALSE); + + return retval; } + diff --git a/cspi/spi_editabletext.c b/cspi/spi_editabletext.c index 3fe3a4c..ff32c30 100644 --- a/cspi/spi_editabletext.c +++ b/cspi/spi_editabletext.c @@ -76,14 +76,16 @@ SPIBoolean AccessibleEditableText_setTextContents (AccessibleEditableText *obj, const char *newContents) { + SPIBoolean retval; + cspi_return_val_if_fail (obj != NULL, FALSE); - Accessibility_EditableText_setTextContents (CSPI_OBJREF (obj), - (CORBA_char *) newContents, cspi_ev ()); + retval = Accessibility_EditableText_setTextContents (CSPI_OBJREF (obj), + (CORBA_char *) newContents, cspi_ev ()); cspi_return_val_if_ev ("setTextContents", FALSE); - return TRUE; + return retval; } /** @@ -107,15 +109,17 @@ AccessibleEditableText_insertText (AccessibleEditableText *obj, const char *text, long int length) { + SPIBoolean retval; + cspi_return_val_if_fail (obj != NULL, FALSE); - Accessibility_EditableText_insertText (CSPI_OBJREF (obj), + retval = Accessibility_EditableText_insertText (CSPI_OBJREF (obj), (CORBA_long) position, (const CORBA_char *) text, (CORBA_long) length, cspi_ev ()); cspi_return_val_if_ev ("insertText", FALSE); - return TRUE; + return retval; } /** @@ -168,15 +172,17 @@ AccessibleEditableText_cutText (AccessibleEditableText *obj, long int startPos, long int endPos) { + SPIBoolean retval; + cspi_return_val_if_fail (obj != NULL, FALSE); - Accessibility_EditableText_cutText ( + retval = Accessibility_EditableText_cutText ( CSPI_OBJREF (obj), (CORBA_long) startPos, (CORBA_long) endPos, cspi_ev ()); cspi_return_val_if_ev ("cutText", FALSE); - return TRUE; + return retval; } /** @@ -199,15 +205,17 @@ AccessibleEditableText_deleteText (AccessibleEditableText *obj, long startPos, long endPos) { + SPIBoolean retval; + cspi_return_val_if_fail (obj != NULL, FALSE); - Accessibility_EditableText_deleteText ( + retval = Accessibility_EditableText_deleteText ( CSPI_OBJREF (obj), (CORBA_long) startPos, (CORBA_long) endPos, cspi_ev ()); cspi_return_val_if_ev ("deleteText", FALSE); - return TRUE; + return retval; } /** @@ -227,12 +235,14 @@ SPIBoolean AccessibleEditableText_pasteText (AccessibleEditableText *obj, long int position) { + SPIBoolean retval; + cspi_return_val_if_fail (obj != NULL, FALSE); - Accessibility_EditableText_pasteText ( + retval = Accessibility_EditableText_pasteText ( CSPI_OBJREF (obj), (CORBA_long) position, cspi_ev ()); cspi_return_val_if_ev ("pasteText", FALSE); - return TRUE; + return retval; } diff --git a/cspi/spi_selection.c b/cspi/spi_selection.c index d66d5cd..9c52e38 100644 --- a/cspi/spi_selection.c +++ b/cspi/spi_selection.c @@ -187,13 +187,15 @@ AccessibleSelection_isChildSelected (AccessibleSelection *obj, SPIBoolean AccessibleSelection_selectAll (AccessibleSelection *obj) { + SPIBoolean retval; + cspi_return_val_if_fail (obj != NULL, FALSE); - Accessibility_Selection_selectAll (CSPI_OBJREF (obj), cspi_ev ()); + retval = Accessibility_Selection_selectAll (CSPI_OBJREF (obj), cspi_ev ()); - cspi_check_ev ("selectAll"); + cspi_return_val_if_ev ("selectAll", FALSE); - return TRUE; /* TODO: change the CORBA method to return SPIBoolean */ + return retval; } /** @@ -202,14 +204,21 @@ AccessibleSelection_selectAll (AccessibleSelection *obj) * * Clear the current selection, removing all selected children from the * specified #AccessibleSelection implementor's selection list. + * + * Returns: #TRUE if successful, #FALSE otherwise. + * **/ -void +SPIBoolean AccessibleSelection_clearSelection (AccessibleSelection *obj) { - cspi_return_if_fail (obj != NULL); + SPIBoolean retval; + + cspi_return_val_if_fail (obj != NULL, FALSE); + + retval = Accessibility_Selection_clearSelection (CSPI_OBJREF (obj), cspi_ev ()); + cspi_return_val_if_ev ("clearSelection", FALSE); - Accessibility_Selection_clearSelection (CSPI_OBJREF (obj), cspi_ev ()); - cspi_check_ev ("clearSelection"); + return retval; } diff --git a/docs/reference/cspi/tmpl/spi_component.sgml b/docs/reference/cspi/tmpl/spi_component.sgml index b6a1372..d797c0d 100644 --- a/docs/reference/cspi/tmpl/spi_component.sgml +++ b/docs/reference/cspi/tmpl/spi_component.sgml @@ -138,5 +138,6 @@ AccessibleComponent Interface @obj: +@Returns: diff --git a/docs/reference/cspi/tmpl/spi_selection.sgml b/docs/reference/cspi/tmpl/spi_selection.sgml index d46f4ae..8ce97c8 100644 --- a/docs/reference/cspi/tmpl/spi_selection.sgml +++ b/docs/reference/cspi/tmpl/spi_selection.sgml @@ -89,6 +89,7 @@ AccessibleSelection Interface @obj: +@Returns: diff --git a/idl/Accessibility_Component.idl b/idl/Accessibility_Component.idl index 71e30b7..cb88cf0 100644 --- a/idl/Accessibility_Component.idl +++ b/idl/Accessibility_Component.idl @@ -44,7 +44,7 @@ module Accessibility { void getSize (out long width, out long height); ComponentLayer getLayer (); short getMDIZOrder (); - void grabFocus (); + boolean grabFocus (); void registerFocusHandler (in EventListener handler); void deregisterFocusHandler (in EventListener handler); diff --git a/idl/Accessibility_EditableText.idl b/idl/Accessibility_EditableText.idl index dbebd63..eb9cd54 100644 --- a/idl/Accessibility_EditableText.idl +++ b/idl/Accessibility_EditableText.idl @@ -26,13 +26,13 @@ module Accessibility { interface EditableText : Text { - void setTextContents (in string newContents); - void insertText (in long position, in string text, in long length); + boolean setTextContents (in string newContents); + boolean insertText (in long position, in string text, in long length); boolean setAttributes (in string attributes, in long startPos, in long endPos); void copyText (in long startPos, in long endPos); - void cutText (in long startPos, in long endPos); - void deleteText (in long startPos, in long endPos); - void pasteText (in long position); + boolean cutText (in long startPos, in long endPos); + boolean deleteText (in long startPos, in long endPos); + boolean pasteText (in long position); /** * unImplemented5: * diff --git a/idl/Accessibility_Selection.idl b/idl/Accessibility_Selection.idl index e1a2628..a5cad01 100644 --- a/idl/Accessibility_Selection.idl +++ b/idl/Accessibility_Selection.idl @@ -30,8 +30,8 @@ module Accessibility { boolean selectChild (in long childIndex); boolean deselectSelectedChild (in long selectedChildIndex); boolean isChildSelected (in long childIndex); - void selectAll (); - void clearSelection (); + boolean selectAll (); + boolean clearSelection (); /** * unImplemented: diff --git a/libspi/component.c b/libspi/component.c index e26af05..1e60da4 100644 --- a/libspi/component.c +++ b/libspi/component.c @@ -187,6 +187,17 @@ impl_accessibility_component_get_mdi_z_order (PortableServer_Servant servant, return (CORBA_short) atk_component_get_mdi_zorder (component); } +static CORBA_boolean +impl_accessibility_component_grab_focus (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + AtkComponent *component = get_component_from_servant (servant); + + g_return_val_if_fail (component != NULL, FALSE); + + return atk_component_grab_focus (component); +} + static void spi_component_class_init (SpiComponentClass *klass) { @@ -200,6 +211,7 @@ spi_component_class_init (SpiComponentClass *klass) epv->getSize = impl_accessibility_component_get_size; epv->getLayer = impl_accessibility_component_get_layer; epv->getMDIZOrder = impl_accessibility_component_get_mdi_z_order; + epv->grabFocus = impl_accessibility_component_grab_focus; } static void diff --git a/libspi/editabletext.c b/libspi/editabletext.c index ea5c326..fb6f7ad 100644 --- a/libspi/editabletext.c +++ b/libspi/editabletext.c @@ -39,11 +39,11 @@ impl_setAttributes (PortableServer_Servant servant, const CORBA_long startPos, const CORBA_long endPos, CORBA_Environment *ev); -static void +static CORBA_boolean impl_setTextContents (PortableServer_Servant servant, const CORBA_char * newContents, CORBA_Environment *ev); -static void +static CORBA_boolean impl_insertText (PortableServer_Servant servant, const CORBA_long position, const CORBA_char * text, @@ -53,15 +53,15 @@ static void impl_copyText (PortableServer_Servant servant, const CORBA_long startPos, const CORBA_long endPos, CORBA_Environment *ev); -static void +static CORBA_boolean impl_cutText (PortableServer_Servant servant, const CORBA_long startPos, const CORBA_long endPos, CORBA_Environment *ev); -static void +static CORBA_boolean impl_deleteText (PortableServer_Servant servant, const CORBA_long startPos, const CORBA_long endPos, CORBA_Environment *ev); -static void +static CORBA_boolean impl_pasteText (PortableServer_Servant servant, const CORBA_long position, CORBA_Environment *ev); @@ -133,20 +133,22 @@ impl_setAttributes (PortableServer_Servant servant, } -static void +static CORBA_boolean impl_setTextContents (PortableServer_Servant servant, const CORBA_char *newContents, CORBA_Environment *ev) { AtkEditableText *editable = get_editable_text_from_servant (servant); - g_return_if_fail (editable != NULL); + g_return_val_if_fail (editable != NULL, FALSE); atk_editable_text_set_text_contents (editable, (gchar *) newContents); + + return TRUE; } -static void +static CORBA_boolean impl_insertText (PortableServer_Servant servant, const CORBA_long position, const CORBA_char *text, @@ -155,12 +157,13 @@ impl_insertText (PortableServer_Servant servant, { AtkEditableText *editable = get_editable_text_from_servant (servant); - g_return_if_fail (editable != NULL); + g_return_val_if_fail (editable != NULL, FALSE); atk_editable_text_insert_text (editable, (gchar *) text, (gint) length, (gint *) &position); + return TRUE; } @@ -174,42 +177,49 @@ impl_copyText (PortableServer_Servant servant, g_return_if_fail (editable != NULL); atk_editable_text_copy_text (editable, (gint) startPos, (gint) endPos); + } -static void +static CORBA_boolean impl_cutText (PortableServer_Servant servant, const CORBA_long startPos, const CORBA_long endPos, CORBA_Environment *ev) { AtkEditableText *editable = get_editable_text_from_servant (servant); - g_return_if_fail (editable != NULL); + g_return_val_if_fail (editable != NULL, FALSE); + + atk_editable_text_cut_text (editable, startPos, endPos); - atk_editable_text_cut_text (editable, (gint) startPos, (gint) endPos); + return TRUE; } -static void +static CORBA_boolean impl_deleteText (PortableServer_Servant servant, const CORBA_long startPos, const CORBA_long endPos, CORBA_Environment *ev) { AtkEditableText *editable = get_editable_text_from_servant (servant); - g_return_if_fail (editable != NULL); + g_return_val_if_fail (editable != NULL, FALSE); - atk_editable_text_delete_text (editable, (gint) startPos, (gint) endPos); + atk_editable_text_delete_text (editable, startPos, endPos); + + return TRUE; } -static void +static CORBA_boolean impl_pasteText (PortableServer_Servant servant, const CORBA_long position, CORBA_Environment *ev) { AtkEditableText *editable = get_editable_text_from_servant (servant); - g_return_if_fail (editable != NULL); + g_return_val_if_fail (editable != NULL, FALSE); atk_editable_text_paste_text (editable, position); + + return TRUE; } diff --git a/libspi/selection.c b/libspi/selection.c index 5932af0..8ef4cb0 100644 --- a/libspi/selection.c +++ b/libspi/selection.c @@ -99,8 +99,7 @@ impl_selectChild (PortableServer_Servant servant, g_return_val_if_fail (selection != NULL, FALSE); - return (CORBA_boolean) - atk_selection_add_selection (selection, (gint) childIndex); + return atk_selection_add_selection (selection, childIndex); } @@ -127,32 +126,32 @@ impl_isChildSelected (PortableServer_Servant servant, g_return_val_if_fail (selection != NULL, FALSE); - return (CORBA_boolean) - atk_selection_is_child_selected (selection, (gint) childIndex); + return atk_selection_is_child_selected (selection, childIndex); } -static void +static CORBA_boolean impl_selectAll (PortableServer_Servant servant, CORBA_Environment *ev) { AtkSelection *selection = get_selection_from_servant (servant); - g_return_if_fail (selection != NULL); + g_return_val_if_fail (selection != NULL, FALSE); + + return atk_selection_select_all_selection (selection); - atk_selection_select_all_selection (selection); } -static void +static CORBA_boolean impl_clearSelection (PortableServer_Servant servant, CORBA_Environment *ev) { AtkSelection *selection = get_selection_from_servant (servant); - g_return_if_fail (selection != NULL); + g_return_val_if_fail (selection != NULL, FALSE); - atk_selection_clear_selection (selection); + return atk_selection_clear_selection (selection); } diff --git a/libspi/table.c b/libspi/table.c index f01cab0..d0df142 100644 --- a/libspi/table.c +++ b/libspi/table.c @@ -117,8 +117,7 @@ impl_getAccessibleAt (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL); - atk_object = atk_table_ref_at (table, - (gint) row, (gint) column); + atk_object = atk_table_ref_at (table, row, column); return spi_accessible_new_return (atk_object, TRUE, ev); } @@ -134,8 +133,7 @@ impl_getIndexAt (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, 0); - return (CORBA_long) - atk_table_get_index_at (table, (gint) row, (gint) column); + return atk_table_get_index_at (table, row, column); } @@ -148,8 +146,7 @@ impl_getRowAtIndex (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, 0); - return (CORBA_long) - atk_table_get_row_at_index (table, (gint) index); + return atk_table_get_row_at_index (table, index); } @@ -162,8 +159,7 @@ impl_getColumnAtIndex (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, 0); - return (CORBA_long) - atk_table_get_column_at_index (table, (gint) index); + return atk_table_get_column_at_index (table, index); } @@ -223,9 +219,7 @@ impl_getRowExtentAt (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, -1); - return (CORBA_long) - atk_table_get_row_extent_at (table, - (gint) row, (gint) column); + return atk_table_get_row_extent_at (table, row, column); } @@ -239,9 +233,7 @@ impl_getColumnExtentAt (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, -1); - return (CORBA_long) - atk_table_get_column_extent_at (table, - (gint) row, (gint) column); + return atk_table_get_column_extent_at (table, row, column); } @@ -255,7 +247,7 @@ impl_getRowHeader (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL); - header = atk_table_get_row_header (table, (gint) row); + header = atk_table_get_row_header (table, row); return spi_accessible_new_return (header, FALSE, ev); } @@ -271,7 +263,7 @@ impl_getColumnHeader (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, CORBA_OBJECT_NIL); - header = atk_table_get_column_header (table, (gint) column); + header = atk_table_get_column_header (table, column); return spi_accessible_new_return (header, FALSE, ev); } @@ -346,7 +338,7 @@ impl_isRowSelected (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, FALSE); - return (CORBA_boolean) atk_table_is_row_selected (table, (gint) row); + return atk_table_is_row_selected (table, row); } @@ -359,7 +351,58 @@ impl_isColumnSelected (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, FALSE); - return (CORBA_boolean) atk_table_is_column_selected (table, (gint) column); + return atk_table_is_column_selected (table, column); +} + +static CORBA_boolean +impl_addRowSelection (PortableServer_Servant servant, + const CORBA_long row, + CORBA_Environment *ev) +{ + AtkTable *table = get_table_from_servant (servant); + + g_return_val_if_fail (table != NULL, FALSE); + + return atk_table_add_row_selection (table, row); +} + + +static CORBA_boolean +impl_addColumnSelection (PortableServer_Servant servant, + const CORBA_long column, + CORBA_Environment *ev) +{ + AtkTable *table = get_table_from_servant (servant); + + g_return_val_if_fail (table != NULL, FALSE); + + return atk_table_add_column_selection (table, column); +} + + +static CORBA_boolean +impl_removeRowSelection (PortableServer_Servant servant, + const CORBA_long row, + CORBA_Environment *ev) +{ + AtkTable *table = get_table_from_servant (servant); + + g_return_val_if_fail (table != NULL, FALSE); + + return atk_table_remove_row_selection (table, row); +} + + +static CORBA_boolean +impl_removeColumnSelection (PortableServer_Servant servant, + const CORBA_long column, + CORBA_Environment *ev) +{ + AtkTable *table = get_table_from_servant (servant); + + g_return_val_if_fail (table != NULL, FALSE); + + return atk_table_remove_column_selection (table, column); } @@ -373,8 +416,8 @@ impl_isSelected (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, FALSE); - return (CORBA_boolean) atk_table_is_selected (table, - (gint) row, (gint) column); + return atk_table_is_selected (table, + row, column); } @@ -403,6 +446,10 @@ spi_table_class_init (SpiTableClass *klass) epv->getSelectedColumns = impl_getSelectedColumns; epv->isRowSelected = impl_isRowSelected; epv->isColumnSelected = impl_isColumnSelected; + epv->addRowSelection = impl_addRowSelection; + epv->addColumnSelection = impl_addColumnSelection; + epv->removeRowSelection = impl_removeRowSelection; + epv->removeColumnSelection = impl_removeColumnSelection; epv->isSelected = impl_isSelected; } diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c index d240b76..3054e6a 100644 --- a/registryd/deviceeventcontroller.c +++ b/registryd/deviceeventcontroller.c @@ -24,7 +24,7 @@ #include -#undef SPI_DEBUG +#define SPI_DEBUG #include #include diff --git a/test/test-simple.c b/test/test-simple.c index f66139a..814d051 100644 --- a/test/test-simple.c +++ b/test/test-simple.c @@ -713,6 +713,7 @@ test_keylisteners (void) while (!(stroke.type & SPI_KEY_PRESSED)) g_main_context_iteration (NULL, TRUE); fprintf (stderr, "p"); + g_assert (!strcmp (stroke.keystring, "=")); while (!(stroke.type & SPI_KEY_RELEASED)) g_main_context_iteration (NULL, TRUE); fprintf (stderr, "r "); @@ -720,7 +721,6 @@ test_keylisteners (void) g_assert (SPI_deregisterAccessibleKeystrokeListener (key_listener, 0)); SPI_freeAccessibleKeySet (test_keyset); - g_assert (!strcmp (stroke.keystring, "=")); fprintf (stderr, "\n"); AccessibleKeystrokeListener_unref (key_listener);