spi: support suppress-screen-reader attribute 13/257013/1
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 16 Apr 2021 10:07:54 +0000 (19:07 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Fri, 16 Apr 2021 10:07:54 +0000 (19:07 +0900)
This patch is supporting following EFL patch.

  elm_atspi: suppress reading of screen-reade
  https://review.tizen.org/gerrit/#/c/platform/upstream/efl/+/257008/

As above patch describes, this patch is neccessary...
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.

Change-Id: I970f3a1eee053d6eb8b91084f79d7bdbfeac2795

src/screen_reader_spi.c

index 65462f200eee347924b07e6731a22fd3b4587706..abe64ff9c3f5aeb474f17dedcfbbd3901bd79c92 100644 (file)
@@ -248,6 +248,16 @@ void spi_event_get_text_to_read(
        *text_to_read = NULL;
        *descr_to_read = NULL;
 
+       GHashTable *attrs = atspi_accessible_get_attributes(event->source, NULL);
+       if (attrs) {
+               char *val = g_hash_table_lookup(attrs, "suppress-screen-reader");
+               DEBUG("got attributes, suppress-screen-reader is '%s'", val);
+               if (val) {
+                       g_hash_table_destroy(attrs);
+                       return;
+               }
+       }
+
        if (cancel) *cancel = 1;
 
        if (!g_strcmp0(event->type, spi->tracking_signal_name)) {
@@ -266,7 +276,6 @@ void spi_event_get_text_to_read(
                spi->ignore_next_caret_move = EINA_TRUE;
                *text_to_read = g_strdup(g_value_get_string(&event->any_data));
 
-               GHashTable *attrs = atspi_accessible_get_attributes(event->source, NULL);
                int mode = 1;
                if (attrs) {
                        char *val = g_hash_table_lookup(attrs, "container-live");
@@ -275,7 +284,6 @@ void spi_event_get_text_to_read(
                                if (g_strcmp0(val, "polite") == 0) mode = 2;
                                else if (g_strcmp0(val, "off") == 0) mode = 0;
                        }
-                       g_hash_table_destroy(attrs);
                }
 
                DEBUG("speaking mode is %d", mode);
@@ -305,6 +313,10 @@ void spi_event_get_text_to_read(
        } else {
                ERROR("Unknown event type");
        }
+
+       if (attrs) {
+               g_hash_table_destroy(attrs);
+       }
 }
 
 /* Warning! this function does not take SpiData as data! */