From 5b003d74fa2e7c6b3bc04e068a4e60c5d5b89aec Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Thu, 30 Nov 2023 18:57:27 +0900 Subject: [PATCH] [TIZEN] Introduce atspi_collection_get_matches_in_matches API. The atspi_collection_get_matches_in_matches API retrieves all accessible objects within an AtspiCollection that match two sets of match rules. This function takes in an AtspiCollection, two AtspiMatchRule pointers, a sorting order, and counts for each match rule. It returns a GArray of AtspiAccessible pointers that match both rules. This API can be used to efficiently retrieve specific subsets of accessible objects within a collection based on their properties.i For example, you could use this API to find all buttons within a dialog box that have the word "OK" in their label. Change-Id: Ia3c216e0800a32471b4a5251f33c8c6a7eda31aa (cherry picked from commit 255ee78225866835b2cf036ddbb2d55133791bf6) --- atspi/atspi-collection.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ atspi/atspi-collection.h | 4 ++++ 2 files changed, 59 insertions(+) diff --git a/atspi/atspi-collection.c b/atspi/atspi-collection.c index 5a44100..d7ef6ac 100644 --- a/atspi/atspi-collection.c +++ b/atspi/atspi-collection.c @@ -260,6 +260,61 @@ atspi_collection_get_matches_from (AtspiCollection *collection, return return_accessibles (reply); } +//TIZEN_ONLY(20231130): Introduce atspi_collection_get_matches_in_matches API. +/** + * atspi_collection_get_matches_in_matches: + * @collection: A pointer to the #AtspiCollection to query. + * @first_rule: An #AtspiMatchRule describing the initial match criteria. + * @second_rule: An #AtspiMatchRule describing additional match criteria. + * @sortby: An #AtspiCollectionSortOrder specifying the way the results are to + * be sorted. + * @first_count: The maximum number of results to return for the initial match, or 0 for no limit. + * @second_count: The maximum number of results to return for the additional match, or 0 for no limit. + * @traverse: Not supported. + * + * Gets all #AtspiAccessible objects from the @collection that match both the @first_rule and @second_rule (if provided). + * + * Returns: (element-type AtspiAccessible*) (transfer full): All + * #AtspiAccessible objects matching the given match both rules. + **/ +GArray * +atspi_collection_get_matches_in_matches (AtspiCollection *collection, + AtspiMatchRule *first_rule, + AtspiMatchRule *second_rule, + AtspiCollectionSortOrder sortby, + gint first_count, + gint second_count, + gboolean traverse, + GError **error) +{ + DBusMessage *message = new_message (collection, "GetMatchesInMatches"); + DBusMessage *reply; + dbus_int32_t d_sortby = sortby; + dbus_int32_t d_count1 = first_count; + dbus_int32_t d_count2 = second_count; + dbus_bool_t d_traverse = traverse; + + if (!message) + return NULL; + + if (!append_match_rule (message, first_rule)) + return NULL; + + if (!append_match_rule (message, second_rule)) + return NULL; + + dbus_message_append_args (message, DBUS_TYPE_UINT32, &d_sortby, + DBUS_TYPE_INT32, &d_count1, + DBUS_TYPE_INT32, &d_count2, + DBUS_TYPE_BOOLEAN, &d_traverse, + DBUS_TYPE_INVALID); + reply = _atspi_dbus_send_with_reply_and_block (message, error); + if (!reply) + return NULL; + return return_accessibles (reply); +} +// + /** * atspi_collection_get_active_descendant: * diff --git a/atspi/atspi-collection.h b/atspi/atspi-collection.h index 9b564c5..5a05260 100644 --- a/atspi/atspi-collection.h +++ b/atspi/atspi-collection.h @@ -55,6 +55,10 @@ GArray * atspi_collection_get_matches_to (AtspiCollection *collection, AtspiAcce GArray * atspi_collection_get_matches_from (AtspiCollection *collection, AtspiAccessible *current_object, AtspiMatchRule *rule, AtspiCollectionSortOrder sortby, AtspiCollectionTreeTraversalType tree, gint count, gboolean traverse, GError **error); +//TIZEN_ONLY(20231130): Introduce atspi_collection_get_matches_in_matches API. +GArray * atspi_collection_get_matches_in_matches (AtspiCollection *collection, AtspiMatchRule *first_rule, AtspiMatchRule *second_rule, AtspiCollectionSortOrder sortby, gint first_count, gint second_count, gboolean traverse, GError **error); +// + AtspiAccessible * atspi_collection_get_active_descendant (AtspiCollection *collection, GError **error); G_END_DECLS -- 2.7.4