From de9d24e09d1989cf048c0fbca5e250f1bde86ee3 Mon Sep 17 00:00:00 2001 From: Lukasz Stanislawski Date: Wed, 25 Jun 2014 11:56:36 +0200 Subject: [PATCH] atspi: unify atspi initialization commit removes internal elm_atspi_init function and moves atspi_app_object creation to atspi_bridge. --- .../elementary/src/lib/elm_atspi_app_object.c | 29 ------------------- legacy/elementary/src/lib/elm_atspi_bridge.c | 18 ++++++++---- legacy/elementary/src/lib/elm_main.c | 3 +- legacy/elementary/src/lib/elm_priv.h | 5 +--- legacy/elementary/src/lib/elm_win.c | 4 +-- 5 files changed, 17 insertions(+), 42 deletions(-) diff --git a/legacy/elementary/src/lib/elm_atspi_app_object.c b/legacy/elementary/src/lib/elm_atspi_app_object.c index 8e8576a528..6313250c88 100644 --- a/legacy/elementary/src/lib/elm_atspi_app_object.c +++ b/legacy/elementary/src/lib/elm_atspi_app_object.c @@ -13,8 +13,6 @@ #include "elm_atspi_app_object.eo.h" extern Eina_List *_elm_win_list; -static Eo *_atspi_root; -static int _init; typedef struct _Elm_Atspi_App_Object_Data Elm_Atspi_App_Object_Data; @@ -71,31 +69,4 @@ _elm_atspi_app_object_elm_interface_atspi_accessible_role_get(Eo *obj EINA_UNUSE return ELM_ATSPI_ROLE_APPLICATION; } -EAPI void -_elm_atspi_init(void) -{ - if (!_init) - { - _atspi_root = eo_add(ELM_ATSPI_APP_OBJECT_CLASS, NULL); - _init = 1; - } -} - -EAPI void -_elm_atspi_shutdown(void) -{ - if (_init) - { - eo_unref(_atspi_root); - _atspi_root = NULL; - _init = 0; - } -} - -EAPI Eo* -_elm_atspi_root_get(void) -{ - return _atspi_root; -} - #include "elm_atspi_app_object.eo.c" diff --git a/legacy/elementary/src/lib/elm_atspi_bridge.c b/legacy/elementary/src/lib/elm_atspi_bridge.c index bdfea92b04..16be16617b 100644 --- a/legacy/elementary/src/lib/elm_atspi_bridge.c +++ b/legacy/elementary/src/lib/elm_atspi_bridge.c @@ -18,6 +18,8 @@ #include "elm_priv.h" #include +#include "elm_atspi_app_object.eo.h" + #include "elm_interface_atspi_accessible.h" #include "elm_interface_atspi_accessible.eo.h" #include "elm_interface_atspi_component.eo.h" @@ -3257,14 +3259,12 @@ _elm_atspi_bridge_init(void) Eldbus_Message *msg; Eldbus_Connection *session_bus; - if (!_init_count && (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF)) + if (!_init_count) { - _elm_atspi_init(); - - _root = _elm_atspi_root_get(); + _root = eo_add(ELM_ATSPI_APP_OBJECT_CLASS, NULL); if (!_root) { - ERR("Unable to get root object"); + ERR("Unable to create root object"); return; } @@ -3282,12 +3282,18 @@ _elm_atspi_bridge_init(void) } } +EAPI Eo* +_elm_atspi_bridge_root_get(void) +{ + return _root; +} + void _elm_atspi_bridge_shutdown(void) { if (_init_count) { - _elm_atspi_shutdown(); + eo_unref(_root); if (_cache_update_idler) ecore_idler_del(_cache_update_idler); diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index 9ca9a03bba..feda8872da 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -310,7 +310,8 @@ elm_init(int argc, system_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MEMORY_STATE, _sys_memory_changed, NULL); system_handlers[1] = ecore_event_handler_add(ECORE_EVENT_LOCALE_CHANGED, _sys_lang_changed, NULL); - _elm_atspi_bridge_init(); + if (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF) + _elm_atspi_bridge_init(); return _elm_init_count; } diff --git a/legacy/elementary/src/lib/elm_priv.h b/legacy/elementary/src/lib/elm_priv.h index c9994df29f..e84bad5ee8 100644 --- a/legacy/elementary/src/lib/elm_priv.h +++ b/legacy/elementary/src/lib/elm_priv.h @@ -342,10 +342,7 @@ struct _Elm_Datetime_Module_Data Elm_Datetime_Field_Type field_type); }; -void _elm_atspi_init(void); -void _elm_atspi_shutdown(void); -Eo *_elm_atspi_root_get(void); - +Eo *_elm_atspi_bridge_root_get(void); void _elm_atspi_bridge_init(void); void _elm_atspi_bridge_shutdown(void); diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index 7e3be34d12..11ca2d35ab 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -3335,7 +3335,7 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t if (_elm_config->atspi_mode == ELM_ATSPI_MODE_ON) { eo_do(obj, elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_WINDOW)); - elm_interface_atspi_accessible_children_changed_added_signal_emit(_elm_atspi_root_get(), obj); + elm_interface_atspi_accessible_children_changed_added_signal_emit(_elm_atspi_bridge_root_get(), obj); eo_do(obj, eo_event_callback_call(ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED, NULL)); } @@ -4819,7 +4819,7 @@ EOLIAN static Eo* _elm_win_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd EINA_UNUSED) { // attach all kinds of windows directly to ATSPI application root object - return _elm_atspi_root_get(); + return _elm_atspi_bridge_root_get(); } #include "elm_win.eo.c"