[at_spi2_tool] report x, y information of accessible object 49/98349/1
authorShinwoo Kim <cinoo.kim@samsung.com>
Sat, 12 Nov 2016 06:01:18 +0000 (15:01 +0900)
committerJaeun Choi <jaeun12.choi@samsung.com>
Thu, 17 Nov 2016 06:19:12 +0000 (15:19 +0900)
Change-Id: Ibcfab40ef65f91617303e86c4fb1b5275de89be7

test/at_spi2_tool.c

index b47d432..7a7b9a5 100644 (file)
@@ -73,6 +73,8 @@ static const char* atspi_state_names[] = {
 };
 
 typedef struct _Box_Size {
+       char *x;
+       char *y;
        char *height;
        char *width;
 } Box_Size;
@@ -97,7 +99,7 @@ static char *_multiply_string(char c, unsigned number)
 
 static void _print_module_legend()
 {
-       printf("\n[[node role name],[attributes list],[width,height],[node name],[states list]]\n\n");
+       printf("\n[[node role name],[attributes list],[x,y,width,height],[node name],[states list]]\n\n");
 }
 
 static void _print_atspi_states_legend()
@@ -194,38 +196,40 @@ static Box_Size *_get_box_size(AtspiAccessible *node)
        if (box_size == NULL)
                return NULL;
 
+       char *x = NULL;
+       char *y = NULL;
        char *width = NULL;
        char *height = NULL;
 
-       _combine_strings(&width, "_");
-       _combine_strings(&height, "_");
-
-       box_size->width = width;
-       box_size->height = height;
-
        AtspiComponent *component = atspi_accessible_get_component_iface(node);
+       AtspiRect *extent = component ? atspi_component_get_extents(component, ATSPI_COORD_TYPE_SCREEN, NULL) : NULL;
 
-       if (component == NULL)
-               return box_size;
-
-       AtspiRect *extent = atspi_component_get_extents(component, ATSPI_COORD_TYPE_SCREEN, NULL);
-       if (extent == NULL)
-               return box_size;
+       if (extent == NULL) {
+               _combine_strings(&x, "_");
+               _combine_strings(&y, "_");
+               _combine_strings(&width, "_");
+               _combine_strings(&height, "_");
+       } else {
+               char temp_buff[NUMBER_WIDTH];
 
-       *width = '\0';
-       *height = '\0';
+               snprintf(temp_buff, NUMBER_WIDTH, "%d", extent->x);
+               _combine_strings(&x, temp_buff);
 
-       char temp_buff[NUMBER_WIDTH];
+               snprintf(temp_buff, NUMBER_WIDTH, "%d", extent->y);
+               _combine_strings(&y, temp_buff);
 
-       snprintf(temp_buff, NUMBER_WIDTH, "%d", extent->width);
-       _combine_strings(&width, temp_buff);
+               snprintf(temp_buff, NUMBER_WIDTH, "%d", extent->width);
+               _combine_strings(&width, temp_buff);
 
-       snprintf(temp_buff, NUMBER_WIDTH, "%d", extent->height);
-       _combine_strings(&height, temp_buff);
+               snprintf(temp_buff, NUMBER_WIDTH, "%d", extent->height);
+               _combine_strings(&height, temp_buff);
 
-       g_object_unref(component);
-       g_free(extent);
+               g_object_unref(component);
+               g_free(extent);
+       }
 
+       box_size->x = x;
+       box_size->y = y;
        box_size->width = width;
        box_size->height = height;
 
@@ -297,9 +301,11 @@ static char *_get_info(AtspiAccessible *node, int length_limit)
        _truncate_string(states, length_limit);
 
        char result[SAFE_BUFFER_SIZE];
-       int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s],[%s],[%s,%s],[%s],[%s]]",
+       int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s],[%s],[%s,%s,%s,%s],[%s],[%s]]",
                                                                                node_role_name,
                                                                                attributes,
+                                                                               box_size->x,
+                                                                               box_size->y,
                                                                                box_size->width,
                                                                                box_size->height,
                                                                                node_name,