entry: improve at-spi2 accessibility support

* return guide text instead of content
* mask passwords
* set proper at-spi roles when entry enables password mode.
This commit is contained in:
Lukasz Stanislawski 2015-06-03 17:36:42 +02:00
parent 27090197cf
commit dd19750273
2 changed files with 29 additions and 0 deletions

View File

@ -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"

View File

@ -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;