From: Shilpa Singh Date: Thu, 30 Nov 2017 09:29:52 +0000 (+0530) Subject: elm: Access: Remove bridge connect callbacks from naviframe, calendar, flipselector. X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~847 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3b257ea52867fa73fb2097afc327f44cdaaa2cf;p=platform%2Fupstream%2Fefl.git elm: Access: Remove bridge connect callbacks from naviframe, calendar, flipselector. Change-Id: Iddd5da6dd694c2527283269e42157e5329612662 --- diff --git a/src/lib/elementary/elc_naviframe.c b/src/lib/elementary/elc_naviframe.c index 233d69c..10a7a71 100644 --- a/src/lib/elementary/elc_naviframe.c +++ b/src/lib/elementary/elc_naviframe.c @@ -326,61 +326,22 @@ _item_signals_emit(Elm_Naviframe_Item_Data *it) //TIZEN ONLY(20151012): expose title as at-spi object static void -_naviframe_atspi_bridge_on_connect_cb(void *data, const Efl_Event *event EINA_UNUSED) +_atspi_expose_title(Elm_Naviframe_Item_Data *it, Eina_Bool is_atspi) { - Elm_Naviframe_Item_Data *it = (Elm_Naviframe_Item_Data*)data; - Evas_Object *part; - Evas_Object *access; - - part = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(VIEW(it)), TITLE_ACCESS_PART); - if (part) + Evas_Object *part = NULL; + Evas_Object *access = NULL; + part = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(VIEW(it)), + TITLE_ACCESS_PART); + if (!part) return; + if (is_atspi) { access = elm_access_object_register(part, VIEW(it)); _elm_access_callback_set(_elm_access_info_get(access), ELM_ACCESS_INFO, _access_info_cb, it); efl_access_role_set(access, EFL_ACCESS_ROLE_HEADING); } -} - -static void -_naviframe_atspi_bridge_on_disconnect_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Elm_Naviframe_Item_Data *it = (Elm_Naviframe_Item_Data*)data; - Evas_Object *part; - part = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(VIEW(it)), TITLE_ACCESS_PART); - elm_access_object_unregister( part ); -} - -static void -_unregister_naviframe_atspi_bridge_callbacks(Elm_Naviframe_Item_Data *it EINA_UNUSED) -{ - Eo *bridge = _elm_atspi_bridge_get(); - if (!bridge) return; - - efl_event_callback_del(bridge, ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _naviframe_atspi_bridge_on_connect_cb, NULL); - efl_event_callback_del(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, _naviframe_atspi_bridge_on_disconnect_cb, NULL); - -} - -static void -_atspi_expose_title(Elm_Naviframe_Item_Data *it, Eina_Bool is_atspi) -{ - Eina_Bool connected = EINA_FALSE; - _unregister_naviframe_atspi_bridge_callbacks(it); - if (!is_atspi) return; - - Eo *bridge = _elm_atspi_bridge_get(); - if (!bridge) return; - - // If bridge is connected expose it now - connected = elm_obj_atspi_bridge_connected_get(bridge); - if (connected) - _naviframe_atspi_bridge_on_connect_cb(it, NULL); - - // Register for bridge connect/disconnect - _unregister_naviframe_atspi_bridge_callbacks(it); - efl_event_callback_add(bridge, ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _naviframe_atspi_bridge_on_connect_cb, NULL); - efl_event_callback_add(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, _naviframe_atspi_bridge_on_disconnect_cb, NULL); + else + elm_access_object_unregister(part); } // @@ -1520,10 +1481,6 @@ _elm_naviframe_efl_canvas_group_group_del(Eo *obj, Elm_Naviframe_Data *sd) evas_object_del(sd->dummy_edje); - // TIZEN_ONLY(20151012): Unregister callbacks for ATSPI bridge enable/disable - _unregister_naviframe_atspi_bridge_callbacks(it); - // - efl_canvas_group_del(efl_super(obj, MY_CLASS)); } diff --git a/src/lib/elementary/elm_calendar.c b/src/lib/elementary/elm_calendar.c index 07677e5..e510a34 100644 --- a/src/lib/elementary/elm_calendar.c +++ b/src/lib/elementary/elm_calendar.c @@ -488,103 +488,65 @@ _month_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED) } // +//TIZEN_ONLY(20160822): When atspi mode is dynamically switched on/off, +//register/unregister access objects accordingly. static void -_calendar_atspi_bridge_on_connect_cb(void *data, const Efl_Event *event EINA_UNUSED) +_atspi_expose_objects(Evas_Object *obj, Eina_Bool is_atspi) { - Evas_Object *obj = (Evas_Object*)data; int day; int maxdays; char day_s[3]; int ii; char pname[14]; Evas_Object *ao, *ac; - - ELM_CALENDAR_DATA_GET(obj, sd); - //TIZEN_ONLY(20160720): Exposing calendar's month name in accessibility tree. - Evas_Object *part, *access; - part = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), MONTH_ACCESS_PART); - elm_access_object_unregister(part); - if (part) - { - access = elm_access_object_register(part, obj); - _elm_access_callback_set(_elm_access_info_get(access), - ELM_ACCESS_INFO, _month_access_info_cb, obj); - efl_access_role_set(access, EFL_ACCESS_ROLE_HEADING); - } - // - day = 0; - maxdays = _maxdays_get(&sd->shown_time, 0); - for (ii = 0; ii < 42; ii++) - { - snprintf(pname, sizeof(pname), "cit_%i.access", ii); - ac = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), pname); - elm_access_object_unregister(ac); - if ((!day) && (ii == sd->first_day_it)) day = 1; - if ((day) && (day <= maxdays)) - { - ao = elm_access_object_register(ac, obj); - efl_access_role_set(ao, EFL_ACCESS_ROLE_TABLE_CELL); - - snprintf(day_s, sizeof(day_s), "%i", day++); - elm_access_info_set(ao, ELM_ACCESS_INFO, (const char*)day_s); - elm_access_info_cb_set(ao, ELM_ACCESS_CONTEXT_INFO, _localized_access_info_cb, "calendar item"); - } - } -} - -static void -_calendar_atspi_bridge_on_disconnect_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Evas_Object *obj = (Evas_Object*)data; - int ii; - char pname[14]; - Evas_Object *ac; - - //TIZEN_ONLY(20160720): Exposing calendar's month name in accessibility tree. Evas_Object *access; - access = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), MONTH_ACCESS_PART); - elm_access_object_unregister(access); - // - - for (ii = 0; ii < 42; ii++) + ELM_CALENDAR_DATA_GET(obj, sd); + if (is_atspi) { - snprintf(pname, sizeof(pname), "cit_%i.access", ii); - ac = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), pname); - elm_access_object_unregister(ac); + //TIZEN_ONLY(20160720): Exposing calendar's month name in accessibility tree. + Evas_Object *part, *access; + part = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), MONTH_ACCESS_PART); + elm_access_object_unregister(part); + if (part) + { + access = elm_access_object_register(part, obj); + _elm_access_callback_set(_elm_access_info_get(access), + ELM_ACCESS_INFO, _month_access_info_cb, obj); + efl_access_role_set(access, EFL_ACCESS_ROLE_HEADING); + } + // + day = 0; + maxdays = _maxdays_get(&sd->shown_time, 0); + for (ii = 0; ii < 42; ii++) + { + snprintf(pname, sizeof(pname), "cit_%i.access", ii); + ac = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), pname); + elm_access_object_unregister(ac); + if ((!day) && (ii == sd->first_day_it)) day = 1; + if ((day) && (day <= maxdays)) + { + ao = elm_access_object_register(ac, obj); + efl_access_role_set(ao, EFL_ACCESS_ROLE_TABLE_CELL); + snprintf(day_s, sizeof(day_s), "%i", day++); + elm_access_info_set(ao, ELM_ACCESS_INFO, (const char*)day_s); + elm_access_info_cb_set(ao, ELM_ACCESS_CONTEXT_INFO, _localized_access_info_cb, "calendar item"); + } + } } -} - -static void -_unregister_atspi_calendar_bridge_callbacks(Evas_Object *obj) -{ - if (!_elm_config->atspi_mode) return; - - Eo *bridge = _elm_atspi_bridge_get(); - if (!bridge) return; - - efl_event_callback_del(bridge, ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _calendar_atspi_bridge_on_connect_cb, obj); - efl_event_callback_del(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, _calendar_atspi_bridge_on_connect_cb, obj); -} - -static void -_atspi_expose_objects(Evas_Object *obj, Eina_Bool is_atspi) -{ - Eina_Bool connected = EINA_FALSE; - // Register bridge connect/disconnect - _unregister_atspi_calendar_bridge_callbacks(obj); - if (is_atspi) + else { - // If already connected register callendar buttons callbacks - Eo *bridge = _elm_atspi_bridge_get(); - if (!bridge) return; - connected = elm_obj_atspi_bridge_connected_get(bridge); - if (connected) - _calendar_atspi_bridge_on_connect_cb(obj, NULL); - efl_event_callback_add(bridge, ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _calendar_atspi_bridge_on_connect_cb, obj); - efl_event_callback_add(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, _calendar_atspi_bridge_on_disconnect_cb, obj); + //TIZEN_ONLY(20160720): Exposing calendar's month name in accessibility tree. + access = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), MONTH_ACCESS_PART); + elm_access_object_unregister(access); + // + for (ii = 0; ii < 42; ii++) + { + snprintf(pname, sizeof(pname), "cit_%i.access", ii); + ac = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), pname); + elm_access_object_unregister(ac); + } } } -// static void _populate(Evas_Object *obj) @@ -1658,10 +1620,6 @@ _elm_calendar_efl_canvas_group_group_del(Eo *obj, Elm_Calendar_Data *sd) for (i = 0; i < ELM_DAY_LAST; i++) eina_stringshare_del(sd->weekdays[i]); - // TIZEN_ONLY(20151012): Unregister callbacks for ATSPI bridge enable/disable - _unregister_atspi_calendar_bridge_callbacks(sd->obj); - // - efl_canvas_group_del(efl_super(obj, MY_CLASS)); } diff --git a/src/lib/elementary/elm_flipselector.c b/src/lib/elementary/elm_flipselector.c index 2ebaada..8d52257 100644 --- a/src/lib/elementary/elm_flipselector.c +++ b/src/lib/elementary/elm_flipselector.c @@ -55,9 +55,6 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { {NULL, NULL} }; -// TIZEN_ONLY(20151012): Unregister callbacks for ATSPI bridge enable/disable -static void _unregister_flipselector_atspi_bridge_callbacks(Elm_Flipselector_Data *sd); -// static Eina_Bool _key_action_flip(Evas_Object *obj, const char *params); static const Elm_Action key_actions[] = { @@ -677,10 +674,6 @@ _elm_flipselector_efl_canvas_group_group_del(Eo *obj, Elm_Flipselector_Data *sd) ecore_timer_del(sd->spin); ecore_job_del(sd->view_update); - // TIZEN_ONLY(20151012): Unregister callbacks for ATSPI bridge enable/disable - _unregister_flipselector_atspi_bridge_callbacks(sd); - // - efl_canvas_group_del(efl_super(obj, MY_CLASS)); } @@ -711,70 +704,36 @@ static Eina_Bool _activate_bottom_cb(void *data, Evas_Object *obj EINA_UNUSED, E } // -//TIZEN ONLY(20151012): register callbacks for ATSPI bridge enable/disable +//TIZEN_ONLY(20160822): When atspi mode is dynamically switched on/off, +//register/unregister access objects accordingly. static void -_flipselector_atspi_bridge_on_connect_cb(void *data, const Efl_Event *event EINA_UNUSED) +_atspi_expose_flipselector_top_bottom(Elm_Flipselector_Data *sd, Eina_Bool is_atspi) { - Elm_Flipselector_Data *sd = (Elm_Flipselector_Data*)data; Evas_Object *btn1; Evas_Object *btn2; - btn1 = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(sd->obj), "top_clipper"); - btn2 = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(sd->obj), "bottom_clipper"); - if (btn1 && btn2) + + if (is_atspi) { - sd->access_top_button = elm_access_object_register(btn1, sd->obj); - sd->access_bottom_button = elm_access_object_register(btn2, sd->obj); + btn1 = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(sd->obj), "top_clipper"); + btn2 = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(sd->obj), "bottom_clipper"); + if (btn1 && btn2) + { + sd->access_top_button = elm_access_object_register(btn1, sd->obj); + sd->access_bottom_button = elm_access_object_register(btn2, sd->obj); - efl_access_role_set(sd->access_top_button, EFL_ACCESS_ROLE_PUSH_BUTTON); - efl_access_role_set(sd->access_bottom_button, EFL_ACCESS_ROLE_PUSH_BUTTON); + efl_access_role_set(sd->access_top_button, EFL_ACCESS_ROLE_PUSH_BUTTON); + efl_access_role_set(sd->access_bottom_button, EFL_ACCESS_ROLE_PUSH_BUTTON); - elm_access_action_cb_set(sd->access_top_button, ELM_ACCESS_ACTION_ACTIVATE, _activate_top_cb, sd); - elm_access_action_cb_set(sd->access_bottom_button, ELM_ACCESS_ACTION_ACTIVATE, _activate_bottom_cb, sd); + elm_access_action_cb_set(sd->access_top_button, ELM_ACCESS_ACTION_ACTIVATE, _activate_top_cb, sd); + elm_access_action_cb_set(sd->access_bottom_button, ELM_ACCESS_ACTION_ACTIVATE, _activate_bottom_cb, sd); + } } -} - -static void -_flipselector_atspi_bridge_on_disconnect_cb(void *data, const Efl_Event *event EINA_UNUSED) -{ - Elm_Flipselector_Data *sd = (Elm_Flipselector_Data*)data; - elm_access_object_unregister(sd->access_top_button); - elm_access_object_unregister(sd->access_bottom_button); -} - -static void -_unregister_flipselector_atspi_bridge_callbacks(Elm_Flipselector_Data *sd) -{ - if (!_elm_config->atspi_mode) return; - - Eo *bridge = _elm_atspi_bridge_get(); - if (!bridge) return; - - efl_event_callback_del(bridge, ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _flipselector_atspi_bridge_on_connect_cb, NULL); - efl_event_callback_del(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, _flipselector_atspi_bridge_on_connect_cb, NULL); -} - -static void -_atspi_expose_flipselector_top_bottom(Elm_Flipselector_Data *sd, Eina_Bool is_atspi) -{ - Eina_Bool connected = EINA_FALSE; - - sd->access_top_button = NULL; - sd->access_bottom_button = NULL; - - // UnRegister for ATSPI bridge enable/disable - _unregister_flipselector_atspi_bridge_callbacks(sd); - - if (is_atspi) + else { - // Expose flipselector buttons - Eo *bridge = _elm_atspi_bridge_get(); - if (!bridge) return; - connected = elm_obj_atspi_bridge_connected_get(bridge); - if (connected) - _flipselector_atspi_bridge_on_connect_cb(sd, NULL); - - efl_event_callback_add(bridge, ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _flipselector_atspi_bridge_on_connect_cb, NULL); - efl_event_callback_add(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, _flipselector_atspi_bridge_on_disconnect_cb, NULL); + elm_access_object_unregister(sd->access_top_button); + elm_access_object_unregister(sd->access_bottom_button); + sd->access_top_button = NULL; + sd->access_bottom_button = NULL; } } //