Add atspi_accessible_get_default_label_info 33/153833/1 submit/tizen/20171012.123430
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 19 Sep 2017 10:59:53 +0000 (19:59 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Sat, 30 Sep 2017 08:23:15 +0000 (17:23 +0900)
It is not possible to support default label feature using current at-spi2-core
APIs without much of IPC. The following would be difficult case to cover.

(top of accessible tree) - (bottom side)
PageTab1 - Panel1 - PageTab2 - Panel2  -  PageTab3 - Panel3(currently showing)

Application could make as below:
PageTab1 - Panel1 - PageTab3 - Panel3  -  PageTab2 - Panel2(currently showing)

or following tree would normally be possilbe:
PageTab1 - Panel1 - PageTab2 - Panel2(currently showing)

There are much of complicated case over there.
So we are handling the default label object stack on toolkit(Elementary) side.

The atspi_accessible_get_default_label_info returns default label information
to be used screen-reader side. This is not stable. And this depends on toolkit
side UI definition. The candidate of default label object could be changed by
UI definition.

AtspiAccessibleDefaultLabelInfo *dli;
dli = atspi_accessible_get_default_label_info(root, &error);

You have to free alocated resource as below, if it is not necessary any more.
g_object_unref(dli->obj);
free(dli);

Change-Id: I444906e6d020ea6fe2536a73473e0e796a015d05

atspi/atspi-accessible.c
atspi/atspi-accessible.h
atspi/atspi-types.h

index 7e889e9..6612a21 100644 (file)
@@ -565,6 +565,54 @@ atspi_accessible_get_reading_material (AtspiAccessible *obj, GError **error)
   return reading_material;
 }
 
+/**
+ * atspi_accessible_get_default_label_info:
+ * @obj: a pointer to the #AtspiAccessible object would be window.
+ *
+ * Gets default label information
+ *
+ * Returns: default label information to be used screen-reader side.
+ * This is not stable. And this depends on toolkit side UI definition.
+ * The candidate of default label object could be changed by UI definition.
+ * You have to handle all alocated memory as below on screen-reader side.
+ *
+ * AtspiAccessibleDefaultLabelInfo *dli
+ * g_object_unref(dli->obj);
+ * free(dli);
+ **/
+AtspiAccessibleDefaultLabelInfo *
+atspi_accessible_get_default_label_info (AtspiAccessible *obj, GError **error)
+{
+  AtspiAccessibleDefaultLabelInfo *default_label_info = NULL;
+  AtspiAccessible *default_label_object;
+  dbus_uint32_t role;
+  DBusMessage *reply;
+  DBusMessageIter iter;
+
+  g_return_val_if_fail (obj != NULL, NULL);
+
+  reply = _atspi_dbus_call_partial (obj, atspi_interface_accessible, "GetDefaultLabelInfo", error, "");
+
+  _ATSPI_DBUS_CHECK_SIG (reply, "(so)u", NULL, NULL);
+
+  default_label_info = calloc(1, sizeof(AtspiAccessibleDefaultLabelInfo));
+  if (!default_label_info)
+  {
+    return default_label_info;
+  }
+
+  dbus_message_iter_init (reply, &iter);
+
+  default_label_object =  _atspi_dbus_return_accessible_from_iter (&iter);
+  default_label_info->obj = default_label_object;
+
+  dbus_message_iter_get_basic (&iter, &role);
+  default_label_info->role = role;
+  dbus_message_iter_next (&iter);
+
+  return default_label_info;
+}
+
 static unsigned char are_objects_on_the_same_bus(AtspiAccessible *obj1, AtspiAccessible *obj2)
 {
   const char *bus_name_1 = obj1->parent.app->bus_name;
index 0b5152b..9efc168 100644 (file)
@@ -45,6 +45,12 @@ G_BEGIN_DECLS
 
 typedef struct _AtspiAccessiblePrivate AtspiAccessiblePrivate;
 
+struct _AtspiAccessibleDefaultLabelInfo
+{
+  AtspiAccessible *obj;
+  AtspiRole role;
+};
+
 struct _AtspiAccessibleReadingMaterial
 {
   AtspiAccessible *parent;
@@ -115,6 +121,8 @@ AtspiAccessible *atspi_accessible_get_neighbor (AtspiAccessible *root, AtspiAcce
 
 AtspiAccessibleReadingMaterial *atspi_accessible_get_reading_material (AtspiAccessible *obj, GError **error);
 
+AtspiAccessibleDefaultLabelInfo *atspi_accessible_get_default_label_info (AtspiAccessible *obj, GError **error);
+
 AtspiAccessible * atspi_accessible_get_parent (AtspiAccessible *obj, GError **error);
 
 gint atspi_accessible_get_child_count (AtspiAccessible *obj, GError **error);
index 45b815c..d09a972 100644 (file)
@@ -44,6 +44,7 @@ typedef struct _AtspiTableCell AtspiTableCell;
 typedef struct _AtspiText AtspiText;
 typedef struct _AtspiValue AtspiValue;
 typedef struct _AtspiAccessibleReadingMaterial AtspiAccessibleReadingMaterial;
+typedef struct _AtspiAccessibleDefaultLabelInfo AtspiAccessibleDefaultLabelInfo;
 
 typedef guint AtspiControllerEventMask;