stanluk pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=9f7de33fdb26db5a3b14fb08a1d99b12cfb41d22

commit 9f7de33fdb26db5a3b14fb08a1d99b12cfb41d22
Author: Lukasz Stanislawski <l.stanisl...@samsung.com>
Date:   Wed Jun 3 17:36:42 2015 +0200

    entry: improve at-spi2 accessibility support
    
    * return guide text instead of content
    * mask passwords
    * set proper at-spi roles when entry enables password mode.
---
 src/lib/elm_entry.c  | 28 ++++++++++++++++++++++++++++
 src/lib/elm_entry.eo |  1 +
 2 files changed, 29 insertions(+)

diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index c20582e..c88cfe2 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -59,6 +59,8 @@
 
 ELM_PRIV_ENTRY_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
 
+#define ENTRY_PASSWORD_MASK_CHARACTER 0x002A
+
 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    ELM_PRIV_ENTRY_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
    {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
@@ -3813,6 +3815,7 @@ _elm_entry_password_set(Eo *obj, Elm_Entry_Data *sd, 
Eina_Bool password)
         sd->line_wrap = ELM_WRAP_NONE;
         elm_entry_input_hint_set(obj, ((sd->input_hints & 
~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA));
         _entry_selection_callbacks_unregister(obj);
+        elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_PASSWORD_TEXT);
      }
    else
      {
@@ -3825,6 +3828,7 @@ _elm_entry_password_set(Eo *obj, Elm_Entry_Data *sd, 
Eina_Bool password)
 
         elm_entry_input_hint_set(obj, ((sd->input_hints | 
ELM_INPUT_HINT_AUTO_COMPLETE) & ~ELM_INPUT_HINT_SENSITIVE_DATA));
         _entry_selection_callbacks_register(obj);
+        elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_ENTRY);
      }
 
    eo_do(obj, elm_obj_widget_theme_apply());
@@ -5112,6 +5116,9 @@ _elm_entry_elm_interface_atspi_text_character_get(Eo 
*obj, Elm_Entry_Data *_pd E
 
    free(txt);
 
+   if (_pd->password)
+     ret = ENTRY_PASSWORD_MASK_CHARACTER;
+
    return ret;
 }
 
@@ -5198,6 +5205,13 @@ _elm_entry_elm_interface_atspi_text_string_get(Eo *obj, 
Elm_Entry_Data *_pd EINA
    evas_textblock_cursor_free(cur);
    evas_textblock_cursor_free(cur2);
 
+   if (ret && _pd->password)
+     {
+        int i = 0;
+        while (ret[i] != '\0')
+         ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER;
+     }
+
    return ret;
 
 fail:
@@ -5233,6 +5247,13 @@ _elm_entry_elm_interface_atspi_text_text_get(Eo *obj, 
Elm_Entry_Data *_pd EINA_U
    evas_textblock_cursor_free(cur);
    evas_textblock_cursor_free(cur2);
 
+   if (ret && _pd->password)
+     {
+        int i = 0;
+        while (ret[i] != '\0')
+         ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER;
+     }
+
    return ret;
 
 fail:
@@ -5647,4 +5668,11 @@ 
_elm_entry_elm_interface_atspi_accessible_state_set_get(Eo *obj, Elm_Entry_Data
    return ret;
 }
 
+EOLIAN static char*
+_elm_entry_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, 
Elm_Entry_Data *sd)
+{
+   const char *ret = edje_object_part_text_get(sd->entry_edje, "elm.guide");
+   return ret ? strdup(ret) : NULL;
+}
+
 #include "elm_entry.eo.c"
diff --git a/src/lib/elm_entry.eo b/src/lib/elm_entry.eo
index c60e848..baf422c 100644
--- a/src/lib/elm_entry.eo
+++ b/src/lib/elm_entry.eo
@@ -1200,6 +1200,7 @@ class Elm.Entry (Elm.Layout, Elm_Interface_Scrollable, 
Evas.Clickable_Interface,
       Elm_Interface_Scrollable.policy.set;
       Elm_Interface_Scrollable.bounce_allow.set;
       Elm_Interface_Atspi_Accessible.state_set.get;
+      Elm_Interface_Atspi_Accessible.name.get;
       Elm_Interface_Atspi_Text.text.get;
       Elm_Interface_Atspi_Text.string.get;
       Elm_Interface_Atspi_Text.attribute.get;

-- 


Reply via email to