atspi: clean-up children-changed event emission.

Patch fixes bugs caused by difference between elm widget
and atspi objects hierarchy.
This commit is contained in:
Lukasz Stanislawski 2015-10-08 12:23:15 +02:00
parent f9fa294776
commit 12feff963e
6 changed files with 45 additions and 21 deletions

View File

@ -397,8 +397,11 @@ _item_content_realize(Elm_Gen_Item *it,
snprintf(buf, sizeof(buf), "elm,state,%s,visible", key);
edje_object_signal_emit(target, buf, "elm");
if (_elm_config->atspi_mode)
eo_do(content, elm_interface_atspi_accessible_parent_set(EO_OBJ(it)));
if (_elm_config->atspi_mode && eo_isa(content, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
{
eo_do(content, elm_interface_atspi_accessible_parent_set(EO_OBJ(it)));
elm_interface_atspi_accessible_children_changed_added_signal_emit(EO_OBJ(it), content);
}
}
}
}

View File

@ -2333,19 +2333,19 @@ _item_new(Evas_Object *obj,
if (it->icon)
{
eo_do(it->icon, elm_interface_atspi_accessible_parent_set(eo_it));
elm_widget_sub_object_add(obj, it->icon);
evas_object_event_callback_add
(it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb,
obj);
eo_do(it->icon, elm_interface_atspi_accessible_parent_set(eo_it));
}
if (it->end)
{
eo_do(it->end, elm_interface_atspi_accessible_parent_set(eo_it));
elm_widget_sub_object_add(obj, it->end);
evas_object_event_callback_add
(it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _size_hints_changed_cb,
obj);
eo_do(it->end, elm_interface_atspi_accessible_parent_set(eo_it));
}
if (_elm_config->atspi_mode)

View File

@ -2367,6 +2367,9 @@ _item_new(Evas_Object *obj,
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
_access_widget_item_register(it);
eo_do(icon_obj, elm_interface_atspi_accessible_parent_set(VIEW(it)));
eo_do(VIEW(it), elm_interface_atspi_accessible_parent_set(eo_it));
if (_item_icon_set(icon_obj, "toolbar/", icon))
{
it->icon = icon_obj;
@ -2434,11 +2437,7 @@ _item_new(Evas_Object *obj,
_item_select(it);
if (_elm_config->atspi_mode)
{
eo_do(icon_obj, elm_interface_atspi_accessible_parent_set(eo_it));
eo_do(VIEW(it), elm_interface_atspi_accessible_parent_set(eo_it));
elm_interface_atspi_accessible_added(eo_it);
}
return it;
}

View File

@ -540,9 +540,6 @@ _elm_widget_evas_object_smart_show(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUS
if (_elm_config->atspi_mode)
{
elm_interface_atspi_accessible_added(obj);
Eo *parent;
eo_do(obj, parent = elm_interface_atspi_accessible_parent_get());
if (parent) elm_interface_atspi_accessible_children_changed_added_signal_emit(parent, obj);
if (_elm_widget_onscreen_is(obj))
elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_SHOWING, EINA_TRUE);
}
@ -563,12 +560,7 @@ _elm_widget_evas_object_smart_hide(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUS
eina_iterator_free(it);
if (_elm_config->atspi_mode)
{
Eo *parent;
eo_do(obj, parent = elm_interface_atspi_accessible_parent_get());
if (parent) elm_interface_atspi_accessible_children_changed_del_signal_emit(parent, obj);
elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_SHOWING, EINA_FALSE);
}
elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_SHOWING, EINA_FALSE);
}
EOLIAN static void
@ -1208,6 +1200,13 @@ _elm_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj
elm_widget_display_mode_set(sobj,
evas_object_size_hint_display_mode_get(obj));
if (_elm_config->atspi_mode && !sdc->on_create)
{
Elm_Interface_Atspi_Accessible *aparent;
eo_do(sobj, aparent = elm_interface_atspi_accessible_parent_get());
if (obj == aparent)
elm_interface_atspi_accessible_children_changed_added_signal_emit(obj, sobj);
}
}
end:
@ -1279,6 +1278,13 @@ _elm_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj
parent = sdp->parent_obj;
}
}
if (_elm_config->atspi_mode && !sd->on_destroy)
{
Elm_Interface_Atspi_Accessible *aparent;
eo_do(sobj, aparent = elm_interface_atspi_accessible_parent_get());
if (obj == aparent)
elm_interface_atspi_accessible_children_changed_del_signal_emit(obj, sobj);
}
ELM_WIDGET_DATA_GET(sobj, sdc);
sdc->parent_obj = NULL;
@ -5709,15 +5715,17 @@ _elm_widget_eo_base_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED)
EOLIAN static void
_elm_widget_eo_base_destructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED)
{
sd->on_destroy = EINA_TRUE;
eo_do(obj,
elm_interface_atspi_accessible_description_set(NULL),
elm_interface_atspi_accessible_name_set(NULL),
elm_interface_atspi_accessible_translation_domain_set(NULL),
elm_interface_atspi_accessible_relationships_clear()
);
elm_interface_atspi_accessible_removed(obj);
eo_do_super(obj, ELM_WIDGET_CLASS, eo_destructor());
sd->on_destroy = EINA_FALSE;
elm_interface_atspi_accessible_removed(obj);
}
EOLIAN static Eina_Bool

View File

@ -443,6 +443,7 @@ typedef struct _Elm_Widget_Smart_Data
Eina_Bool highlight_root : 1;
Eina_Bool on_translate : 1; /**< This is true when any types of elm translate function is being called. */
Eina_Bool on_create : 1; /**< This is true when the widget is on creation(general widget constructor). */
Eina_Bool on_destroy: 1; /**< This is true when the widget is on destruction(general widget destructor). */
} Elm_Widget_Smart_Data;
/**

View File

@ -1578,6 +1578,14 @@ _elm_win_evas_object_smart_show(Eo *obj, Elm_Win_Data *sd)
TRAP(sd, show);
if (_elm_config->atspi_mode)
{
Eo *bridge = _elm_atspi_bridge_get();
elm_interface_atspi_window_created_signal_emit(obj);
if (bridge)
elm_interface_atspi_accessible_children_changed_added_signal_emit(elm_atspi_bridge_root_get(bridge), obj);
}
if (sd->shot.info) _shot_handle(sd);
}
@ -1615,7 +1623,12 @@ _elm_win_evas_object_smart_hide(Eo *obj, Elm_Win_Data *sd)
#endif
}
if (_elm_config->atspi_mode)
elm_interface_atspi_window_deactivated_signal_emit(obj);
{
Eo *bridge = _elm_atspi_bridge_get();
elm_interface_atspi_window_destroyed_signal_emit(obj);
if (bridge)
elm_interface_atspi_accessible_children_changed_del_signal_emit(elm_atspi_bridge_root_get(bridge), obj);
}
if (_elm_win_policy_quit_triggered(obj))
_elm_win_flush_cache_and_exit(obj);
@ -3867,7 +3880,7 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
}
eo_do(obj, elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_WINDOW));
if (_elm_config->atspi_mode == ELM_ATSPI_MODE_ON)
if (_elm_config->atspi_mode)
elm_interface_atspi_window_created_signal_emit(obj);
evas_object_show(sd->edje);