Navigation through disabled ui elements will give disable feedback
authorŁukasz Buśko <l.busko@samsung.com>
Tue, 13 Jan 2015 11:14:33 +0000 (12:14 +0100)
committerŁukasz Buśko <l.busko@samsung.com>
Tue, 13 Jan 2015 12:56:25 +0000 (13:56 +0100)
Change-Id: I4c9df2c2eaf366d68574035c677aad2e9c4ee98a

src/navigator.c
src/screen_reader_xml.c

index 176a4b0..51e28cf 100644 (file)
@@ -24,7 +24,7 @@
    {\
      ERROR("Error_log:%s",error->message);\
      g_error_free(error);\
-        error = NULL;\
+     error = NULL;\
    }
 
 static AtspiAccessible *current_obj;
@@ -512,6 +512,7 @@ static void _activate_widget(void)
                 atspi_action_do_action(action, 0, &err);
                 GERROR_CHECK(err)
             }
+            g_free(actionName);
         }
 
 }
index ffe2abf..2349e0e 100644 (file)
@@ -4,7 +4,7 @@
  *  Created on: Mar 26, 2014
  *      Author: m.skorupinsk
  */
-
+#include <stdio.h>
 #include "logger.h"
 #include "screen_reader_xml.h"
 
@@ -37,12 +37,46 @@ char *get_text_to_read(const char *action, AtspiAccessible *widget)
        DEBUG("THE LEVEL STRING: %s LEVEL: %d\n", level_str, level);
 
        attributes[0] = eina_simple_xml_attribute_new(NULL, "level", level_str);
-       char *ret_str = NULL;
-
-       ret_str = get_string_str(NULL, description, attributes, "Information_Level");
 
+       char *ret_str;
+       char *tmp = get_string_str(NULL, description, attributes, "Information_Level");
        eina_simple_xml_attribute_free(attributes[0]);
 
+       AtspiStateSet *state_set = atspi_accessible_get_state_set (widget);
+       AtspiStateType state =  ATSPI_STATE_ENABLED;
+       gboolean bstate = atspi_state_set_contains(state_set, state);
+
+       g_object_unref(state_set);
+
+       if(!bstate)
+         {
+           const char *string_is_disable = "is disabled";
+           GError *err = NULL;
+           int ret_str_size;
+           int cnt;
+
+           ret_str_size = strlen(tmp) + strlen(string_is_disable) + 1;/* offset for spaces */
+           ret_str = malloc(ret_str_size);
+           if(!ret_str)
+             {
+               ERROR("Failed to allocate memory");
+               free(tmp);
+               return NULL;
+             }
+           /* example push_button BLUE is disabled */
+           cnt = snprintf(ret_str, ret_str_size, "%s %s", tmp, string_is_disable);
+           free(tmp);
+           if (cnt < ret_str_size)/* Buffer should be of expected size and this also checks for -1 error */
+             {
+               ERROR("Failed to format buffer...");
+               ERROR("Buffer[%d/%d][%s]", cnt, ret_str_size, ret_str);
+               free(ret_str);
+               return NULL;
+             }
+         }
+        else
+          ret_str = tmp;
+
        DEBUG("\n\n-> -> -> THE STRING TO SAY: <- <- <- \n%s\n\n", ret_str);
 
        return ret_str;