elm_atspi: suppress reading of screen-reader 08/257008/3
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 16 Apr 2021 09:02:58 +0000 (18:02 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 11 May 2021 11:11:21 +0000 (20:11 +0900)
Because there is legacy code for screen-reader, an application could want
to keep previous behavior of the screen-reader even though the ATSPI is
enabled by AT client such as Aurum test framework.

If an application wants to make screen-reader AT client do not read,
then set suppress to EINA_TRUE. The default suppress is @c EINA_FALSE.

This patch is also handling env. variable ELM_SUPPRESS_SCREEN_READER
to define default behavior.

*tizen-only

Change-Id: Ia138fd6fb21c731588eff2deec2ae59a61b3c981

src/lib/elementary/elm_atspi_bridge.c
src/lib/elementary/elm_atspi_bridge.h

index 5c6cb5d..a81e6da 100644 (file)
@@ -145,6 +145,9 @@ typedef struct _Elm_Atspi_Bridge_Data
    //TIZEN_ONLY(20161027) - Export elm_atspi_bridge_utils_is_screen_reader_enabled
    Eina_Bool screen_reader_enabled : 1;
    //
+   //TIZEN_ONLY(20210416) - Suppress screen reader
+   Eina_Bool suppress_screen_reader : 1;
+   //
 } Elm_Atspi_Bridge_Data;
 
 
@@ -743,6 +746,17 @@ _accessible_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_M
         eldbus_message_iter_container_close(iter_dict, iter_entry);
      }
 
+   //TIZEN_ONLY(20210416) - Suppress screen reader
+   Elm_Atspi_Bridge_Data *sd = efl_data_scope_get(bridge, ELM_ATSPI_BRIDGE_CLASS);
+   if (sd && sd->suppress_screen_reader)
+     {
+        iter_entry = eldbus_message_iter_container_new(iter_dict, 'e', NULL);
+        if (!iter_entry) goto error;
+        eldbus_message_iter_arguments_append(iter_entry, "ss", "suppress-screen-reader", "true");
+        eldbus_message_iter_container_close(iter_dict, iter_entry);
+     }
+   //
+
    eldbus_message_iter_container_close(iter, iter_dict);
    efl_access_attributes_list_free(attrs);
    return ret;
@@ -7503,6 +7517,11 @@ _elm_atspi_bridge_efl_object_constructor(Eo *obj, Elm_Atspi_Bridge_Data *pd)
    ecore_fork_reset_callback_add(_on_fork_reset, obj);
    //
 
+   //TIZEN_ONLY(20210416) - Suppress screen reader
+   const char *suppress = getenv("ELM_SUPPRESS_SCREEN_READER");
+   pd->suppress_screen_reader = suppress ? !!atoi(suppress) : EINA_FALSE;
+   //
+
    return obj;
 
 proxy_err:
@@ -8231,4 +8250,25 @@ EAPI Eina_Bool elm_atspi_bridge_utils_is_screen_reader_enabled(void)
 }
 //
 
+//TIZEN_ONLY(20210416) - Suppress screen reader
+EAPI Eina_Bool elm_atspi_bridge_utils_suppress_screen_reader_set(Eina_Bool suppress)
+{
+   Eo *bridge = _elm_atspi_bridge_get();
+   if (!bridge)
+     return EINA_FALSE;
+   ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, EINA_FALSE);
+   pd->suppress_screen_reader = !!suppress;
+   return EINA_TRUE;
+}
+
+EAPI Eina_Bool elm_atspi_bridge_utils_suppress_screen_reader_get(void)
+{
+   Eo *bridge = _elm_atspi_bridge_get();
+   if (!bridge)
+     return EINA_FALSE;
+   ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, EINA_FALSE);
+   return pd->suppress_screen_reader;
+}
+//
+
 #include "elm_atspi_bridge_eo.c"
index 32080c8..c4492b2 100644 (file)
@@ -83,3 +83,28 @@ EAPI Eina_Bool elm_atspi_bridge_utils_is_screen_reader_enabled(void);
  */
 EAPI void elm_atspi_bridge_highlighted_object_read(void);
 //
+
+//TIZEN_ONLY(20210416) - Suppress screen reader
+/**
+ * @brief Sets screen reader suppress
+ *
+ * Because there is legacy code for screen-reader, an application could want
+ * to keep previous behavior of the screen-reader even though the ATSPI is
+ * enabled. If you want to make screen-reader AT client do not work for your
+ * application, then set @c suppress to @c EINA_TRUE.
+ * Default suppress is @c EINA_FALSE.
+ *
+ * @internal
+ * @ingroup Elm_Atspi_Bridge
+ */
+EAPI Eina_Bool elm_atspi_bridge_utils_suppress_screen_reader_set(Eina_Bool suppress);
+
+/**
+ * @brief Gets screen reader suppress
+ * @see elm_atspi_bridge_utils_suppress_screen_reader_set
+ *
+ * @internal
+ * @ingroup Elm_Atspi_Bridge
+ */
+EAPI Eina_Bool elm_atspi_bridge_utils_suppress_screen_reader_get(void);
+//