From d88cbf20c919aae1122e936819c06b19f99774ee Mon Sep 17 00:00:00 2001 From: Lukasz Stanislawski Date: Thu, 8 Oct 2015 12:23:15 +0200 Subject: [PATCH] atspi: clean-up children-changed event emission. Patch fixes bugs caused by difference between elm widget and atspi objects hierarchy. --- src/lib/elm_genlist.c | 7 +++++-- src/lib/elm_list.c | 4 ++-- src/lib/elm_toolbar.c | 7 +++---- src/lib/elm_widget.c | 30 +++++++++++++++++++----------- src/lib/elm_widget.h | 1 + src/lib/elm_win.c | 17 +++++++++++++++-- 6 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index cb71fb9..2e4bd8b 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -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); + } } } } diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index c4b81a0..065caa4 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -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) diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 58914b2..b5096b4 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -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; } diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 4996141..65d049a 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -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 diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 9f570a9..e553ec5 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -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; /** diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index c07b7fb..ff52d3b 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -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); -- 2.7.4