From cac6b003ac46eeccaea3d7c3d15f399c25b9558e Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Fri, 4 Jun 2021 20:20:00 +0900 Subject: [PATCH] atspi: add atspi bridge ready event Summary: calling elm_init does not guarantee of readiness of atspi bridge even though elm_init is calling _elm_atspi_bridge_init. widget or user could want to know when the atspi bridge is ready. Reviewers: Hermet, jsuya, herb Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12283 Change-Id: I75f1f45851ec51af07d3f9ba68d69019160ed721 --- src/lib/elementary/elm_atspi_bridge.c | 18 ++++++++++++++++++ src/lib/elementary/elm_general.h | 28 ++++++++++++++++++++++++++++ src/lib/elementary/elm_main.c | 1 + 3 files changed, 47 insertions(+) diff --git a/src/lib/elementary/elm_atspi_bridge.c b/src/lib/elementary/elm_atspi_bridge.c index 3ddae2b..0573cd8 100644 --- a/src/lib/elementary/elm_atspi_bridge.c +++ b/src/lib/elementary/elm_atspi_bridge.c @@ -172,6 +172,8 @@ static int _init_count = 0; static const char *_a11y_socket_address; // +EAPI int ELM_EVENT_ATSPI_BRIDGE_STATE_CHANGED = -1; + // Object Event handlers static void _state_changed_signal_send(void *data, const Efl_Event *event); static void _bounds_changed_signal_send(void *data, const Efl_Event *event); @@ -6106,6 +6108,7 @@ end: static void _registered_listeners_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending) { + Elm_Event_Atspi_Bridge_State_Changed *e; const char *event, *bus; ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(data, pd); pd->pending_requests = eina_list_remove(pd->pending_requests, pending); @@ -6156,6 +6159,13 @@ _registered_listeners_get(void *data, const Eldbus_Message *msg, Eldbus_Pending _plug_connect(pd->a11y_bus, pr); pd->socket_queue = pd->plug_queue = NULL; + + e = calloc(1, sizeof(Elm_Event_Atspi_Bridge_State_Changed)); + if (e) + { + e->state = ELM_ATSPI_BRIDGE_CONNECTED; + ecore_event_add(ELM_EVENT_ATSPI_BRIDGE_STATE_CHANGED, e, NULL, NULL); + } } // } @@ -6847,6 +6857,7 @@ _interfaces_unregister(Eo *bridge) static void _a11y_connection_shutdown(Eo *bridge) { + Elm_Event_Atspi_Bridge_State_Changed *e; ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd); // TIZEN_ONLY(20171109) : fix for invalid proxy object, when at-spi has been restarted @@ -6901,6 +6912,13 @@ _a11y_connection_shutdown(Eo *bridge) pd->event_hdlr = NULL; efl_event_callback_legacy_call(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, NULL); + e = calloc(1, sizeof(Elm_Event_Atspi_Bridge_State_Changed)); + if (e) + { + e->state = ELM_ATSPI_BRIDGE_DISCONNECTED; + ecore_event_add(ELM_EVENT_ATSPI_BRIDGE_STATE_CHANGED, e, NULL, NULL); + } + pd->connected = EINA_FALSE; } diff --git a/src/lib/elementary/elm_general.h b/src/lib/elementary/elm_general.h index 93eed1e..36cbe116 100644 --- a/src/lib/elementary/elm_general.h +++ b/src/lib/elementary/elm_general.h @@ -491,6 +491,28 @@ typedef enum ELM_FOCUS_REGION_SHOW_ITEM /**< As an item. */ } Elm_Focus_Region_Show_Mode; +/** Possible values for the atspi bridge state. + * + * @since 1.26 + * + * @ingroup Elm_Atspi_Bridge + */ +typedef enum +{ + ELM_ATSPI_BRIDGE_CONNECTED = 0, /**< when atspi bridge is ready */ + ELM_ATSPI_BRIDGE_DISCONNECTED, /**< when atspi bridge is shutdown */ +} Elm_Atspi_Bridge_State; + +/** Data on event when atspi bridge state is changed + * + * @since 1.26 + * + * @ingroup Elm_Atspi_Bridge + */ +typedef struct _Elm_Event_Atspi_Bridge_State_Changed +{ + Elm_Atspi_Bridge_State state; +} Elm_Event_Atspi_Bridge_State_Changed; /**************************************************************************/ EAPI extern int ELM_ECORE_EVENT_ETHUMB_CONNECT; @@ -520,6 +542,12 @@ EAPI extern int ELM_EVENT_PROCESS_BACKGROUND; */ EAPI extern int ELM_EVENT_PROCESS_FOREGROUND; +/** + * Emitted when atspi bridge state is changed. + * @since 1.26 + */ +EAPI extern int ELM_EVENT_ATSPI_BRIDGE_STATE_CHANGED; + typedef Eina_Bool (*Elm_Event_Cb)(void *data, Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info); /**< Function prototype definition for callbacks on input events happening on Elementary widgets. @a data will receive the user data pointer passed to elm_object_event_callback_add(). @a src will be a pointer to the widget on which the input event took place. @a type will get the type of this event and @a event_info, the struct with details on this event. */ EAPI extern double _elm_startup_time; diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 258ffd9..d41cc68 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -454,6 +454,7 @@ elm_init(int argc, char **argv) // ELM_CNP_EVENT_SELECTION_CHANGED = ecore_event_type_new(); + ELM_EVENT_ATSPI_BRIDGE_STATE_CHANGED = ecore_event_type_new(); //TIZEN_ONLY(20210423): move atspi init to elm_run /* -- 2.7.4