#define FIRST_MATCH 2
#define RELATION_TABLE_COLUMN_COUNT 7
#define ATTRIBUTE_TABLE_COLUMN_COUNT 3
+#define ACTIONS_TABLE_COLUMN_COUNT 2
#define RELATION_TABLE_COLUMN_WIDTH 20
#define ATTRIBUTE_TABLE_BASE_COLUMN_WIDTH 20
+#define ACTIONS_TABLE_BASE_COLUMN_WIDTH 20
#define VERSION "1.1"
static unsigned indent_width = 2;
return result;
}
-static char *_get_info(AtspiAccessible *node, int length_limit, bool *attributes_are_too_long, bool *app_has_relations)
+static char *_get_info(AtspiAccessible *node, int length_limit, bool *attributes_are_too_long, bool *app_has_relations, bool *app_has_actions)
{
if (!node)
return NULL;
GArray *relations = atspi_accessible_get_relation_set(node, NULL);
bool current_node_has_relations = (relations && relations->len);
+ bool current_node_has_actions = false;
+
+ AtspiAction* action_if = atspi_accessible_get_action_iface (node);
+ if (action_if)
+ {
+ gint no_actions = atspi_action_get_n_actions (action_if, NULL);
+ if (no_actions > 0) current_node_has_actions = true;
+ }
+
char result[SAFE_BUFFER_SIZE];
int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s(%p)],[%s],[%s],[%s,%s,%s,%s],[%s],[%s],[%s]]",
unique_id, (uintptr_t)eo_ptr,
if (current_node_has_relations)
*app_has_relations = true;
+ if (current_node_has_actions)
+ *app_has_actions = true;
+
free(node_name);
free(node_role_name);
free(unique_id);
}
static int _print_atspi_tree_verify_maybe_r(int indent_number, AtspiAccessible *object, bool check_integrity, int length_limit,
- bool *attributes_are_too_long, bool *app_has_relations)
+ bool *attributes_are_too_long, bool *app_has_relations, bool *app_has_actions)
{
char *indent = _multiply_string(' ', indent_number*indent_width);
if (indent != NULL) {
free(indent);
}
- char *node_info = _get_info(object, length_limit, attributes_are_too_long, app_has_relations);
+ char *node_info = _get_info(object, length_limit, attributes_are_too_long, app_has_relations, app_has_actions);
if (node_info != NULL) {
printf("%s\n", node_info);
free(node_info);
if (check_integrity)
_test_atspi_parent_child_relation(child, object, i);
- _print_atspi_tree_verify_maybe_r(indent_number + 1, child, check_integrity, length_limit, attributes_are_too_long, app_has_relations);
+ _print_atspi_tree_verify_maybe_r(indent_number + 1, child, check_integrity, length_limit, attributes_are_too_long, app_has_relations, app_has_actions);
}
}
return 0;
_print_relations_for_objects_in_tree(node);
}
+static void _print_horizontal_line_in_actions_table() {
+ int size_factor = 1;
+ for (int i = 0; i < ACTIONS_TABLE_COLUMN_COUNT; i++) {
+ if (i == ACTIONS_TABLE_COLUMN_COUNT - 1)
+ size_factor = 4;
+ for (int j = 0; j < ACTIONS_TABLE_BASE_COLUMN_WIDTH * size_factor; j++)
+ printf("-");
+ printf("+");
+ }
+ printf("\n");
+}
+
+static void _print_actions_for_object(AtspiAccessible *node) {
+ char *unique_id = atspi_accessible_get_unique_id(node, NULL);
+ AtspiAction* action_if = atspi_accessible_get_action_iface (node);
+ if (action_if) {
+ gint no_actions = atspi_action_get_n_actions (action_if, NULL);
+ for (int i=0; i< no_actions; i++) {
+ gchar * ith_action = atspi_action_get_action_name (action_if, i, NULL);
+ printf("%*s|", ACTIONS_TABLE_BASE_COLUMN_WIDTH, unique_id ? unique_id : "");
+ printf("%*s|\n", ACTIONS_TABLE_BASE_COLUMN_WIDTH * 4, ith_action ? (char *) ith_action : "");
+ g_free(ith_action);
+ }
+ _print_horizontal_line_in_actions_table();
+ }
+ free(unique_id);
+}
+
+static void _print_actions_for_objects_in_tree(AtspiAccessible *node) {
+ _iterate_over_tree(_print_actions_for_object, node);
+}
+
+static void _print_header_for_actions_table() {
+ char *table[] = {"OBJECT", "SUPPORTED ACTION"};
+ assert(ARRAY_SIZE(table) == ACTIONS_TABLE_COLUMN_COUNT);
+
+ _print_horizontal_line_in_actions_table();
+
+ int size_factor = 1;
+ for (int i = 0; i < ACTIONS_TABLE_COLUMN_COUNT; i++) {
+ if (i == ACTIONS_TABLE_COLUMN_COUNT - 1)
+ size_factor = 4;
+ printf("%*s|", ACTIONS_TABLE_BASE_COLUMN_WIDTH * size_factor , table[i]);
+ }
+
+ printf("\n");
+ _print_horizontal_line_in_actions_table();
+}
+
+static void _print_actions_table(AtspiAccessible *node) {
+ printf("\nSUPPPORTED ACTIONS TABLE\n");
+ _print_header_for_actions_table();
+ _print_actions_for_objects_in_tree(node);
+}
+
static void _print_horizontal_line_in_attributes_table() {
int size_factor = 1;
for (int i = 0; i < ATTRIBUTE_TABLE_COLUMN_COUNT; i++) {
char *name = atspi_accessible_get_name(child, NULL);
bool attributes_are_too_long = false;
bool app_has_relations = false;
+ bool app_has_actions = false;
if (!dump && !check)
printf("%s\n", name);
if (check)
_test_atspi_parent_child_relation(child, desktop, i);
- _print_atspi_tree_verify_maybe_r(0, child, check, length_limit, &attributes_are_too_long, &app_has_relations);
+ _print_atspi_tree_verify_maybe_r(0, child, check, length_limit, &attributes_are_too_long, &app_has_relations, &app_has_actions);
if (app_has_relations)
_print_relations_table(child);
if (attributes_are_too_long)
_print_attributes_table(child);
+ if (app_has_actions)
+ _print_actions_table(child);
+
if (first_match) {
free(name);
break;