From: Shinwoo Kim Date: Tue, 5 Dec 2017 13:22:33 +0000 (+0530) Subject: elm: [atspi] make atspi proxy work for more than two sockets created in one process X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~823 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55bb6d0eb7b4b2ecd323cf2fa71900e4a4ed4542;p=platform%2Fupstream%2Fefl.git elm: [atspi] make atspi proxy work for more than two sockets created in one process Change-Id: I953f3054614fc86ddb1d3c8cefedf4f1044a361c Signed-off-by: Shilpa Singh --- diff --git a/src/lib/elementary/efl_access_component.c b/src/lib/elementary/efl_access_component.c index 4739a1c..42a64a7 100644 --- a/src/lib/elementary/efl_access_component.c +++ b/src/lib/elementary/efl_access_component.c @@ -9,9 +9,18 @@ #include "elm_priv.h" +//TIZEN_ONLY(20161114): make atspi proxy work for more than two sockets created in one process +struct _Efl_Access_Component_Data +{ + Evas_Point socket_offset; +}; + +typedef struct _Efl_Access_Component_Data Efl_Access_Component_Data; +// + EOLIAN static void -_efl_access_component_position_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int *x, int *y) +_efl_access_component_position_get(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED, Eina_Bool type, int *x, int *y) { Eina_Rect r; @@ -21,7 +30,7 @@ _efl_access_component_position_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, E } EOLIAN static Eina_Bool -_efl_access_component_position_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int x, int y) +_efl_access_component_position_set(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED, Eina_Bool type, int x, int y) { Eina_Rect r; @@ -32,7 +41,7 @@ _efl_access_component_position_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, E } EOLIAN static Eina_Bool -_efl_access_component_size_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int w, int h) +_efl_access_component_size_set(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED, int w, int h) { Eina_Rect r; @@ -43,7 +52,7 @@ _efl_access_component_size_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int w } EOLIAN static void -_efl_access_component_size_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int *w, int *h) +_efl_access_component_size_get(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED, int *w, int *h) { Eina_Rect r; @@ -53,7 +62,7 @@ _efl_access_component_size_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int * } EOLIAN static Eina_Bool -_efl_access_component_contains(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_Bool type, int x, int y) +_efl_access_component_contains(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED, Eina_Bool type, int x, int y) { Eina_Rect r; @@ -62,7 +71,7 @@ _efl_access_component_contains(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, Eina_ } EOLIAN static double -_efl_access_component_alpha_get(Eo *obj, void *_pd EINA_UNUSED) +_efl_access_component_alpha_get(Eo *obj, Efl_Access_Component_Data *_pd EINA_UNUSED) { int alpha; @@ -71,7 +80,7 @@ _efl_access_component_alpha_get(Eo *obj, void *_pd EINA_UNUSED) } EOLIAN static Eo * -_efl_access_component_accessible_at_point_get(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, int x, int y) +_efl_access_component_accessible_at_point_get(Eo *obj, Efl_Access_Component_Data *_pd EINA_UNUSED, Eina_Bool screen_coords, int x, int y) { Eina_List *l, *children; Eo *ret = NULL, *child; @@ -104,7 +113,7 @@ _efl_access_component_accessible_at_point_get(Eo *obj, void *_pd EINA_UNUSED, Ei } EOLIAN static Eina_Rect -_efl_access_component_extents_get(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords) +_efl_access_component_extents_get(Eo *obj, Efl_Access_Component_Data *_pd EINA_UNUSED, Eina_Bool screen_coords) { Eina_Rect r; @@ -124,7 +133,7 @@ _efl_access_component_extents_get(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool scre } EOLIAN static Eina_Bool -_efl_access_component_extents_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool screen_coords, Eina_Rect r) +_efl_access_component_extents_set(Eo *obj, Efl_Access_Component_Data *_pd EINA_UNUSED, Eina_Bool screen_coords, Eina_Rect r) { int wx, wy; @@ -146,20 +155,20 @@ _efl_access_component_extents_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool scre } EOLIAN static int -_efl_access_component_layer_get(Eo *obj, void *_pd EINA_UNUSED) +_efl_access_component_layer_get(Eo *obj, Efl_Access_Component_Data *_pd EINA_UNUSED) { return evas_object_layer_get(obj); } EOLIAN static int -_efl_access_component_z_order_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED) +_efl_access_component_z_order_get(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED) { // Currently not used. return 0; } EOLIAN static Eina_Bool -_efl_access_component_focus_grab(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED) +_efl_access_component_focus_grab(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED) { evas_object_focus_set(obj, EINA_TRUE); return evas_object_focus_get(obj); @@ -167,7 +176,7 @@ _efl_access_component_focus_grab(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED) //TIZEN_ONLY(20171108): bring HIGHLIGHT related changes EOLIAN static Eina_Bool -_efl_access_component_highlight_grab(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED) +_efl_access_component_highlight_grab(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED) { WRN("The %s object does not implement the \"component_highlight_grab\" function.", efl_class_name_get(efl_class_get(obj))); @@ -175,7 +184,7 @@ _efl_access_component_highlight_grab(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED) } EOLIAN static Eina_Bool -_efl_access_component_highlight_clear(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED) +_efl_access_component_highlight_clear(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd EINA_UNUSED) { WRN("The %s object does not implement the \"component_highlight_clear\" function.", efl_class_name_get(efl_class_get(obj))); @@ -183,4 +192,20 @@ _efl_access_component_highlight_clear(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED } // +//TIZEN_ONLY(20161114): make atspi proxy work for more than two sockets created in one process +EOLIAN static void +_efl_access_component_socket_offset_set(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd, int x, int y) +{ + _pd->socket_offset.x = x; + _pd->socket_offset.y = y; +} + +EOLIAN static void +_efl_access_component_socket_offset_get(Eo *obj EINA_UNUSED, Efl_Access_Component_Data *_pd, int *x, int *y) +{ + *x = _pd->socket_offset.x; + *y = _pd->socket_offset.y; +} +// + #include "efl_access_component.eo.c" diff --git a/src/lib/elementary/efl_access_component.eo b/src/lib/elementary/efl_access_component.eo index a3a3799..f31e8b5 100644 --- a/src/lib/elementary/efl_access_component.eo +++ b/src/lib/elementary/efl_access_component.eo @@ -3,7 +3,7 @@ import eina_types; mixin Efl.Access.Component () { [[AT-SPI component mixin]] - data: null; + data: Efl_Access_Component_Data; methods { @property size @protected @beta { [[Size of accessible widget.]] @@ -117,5 +117,19 @@ mixin Efl.Access.Component () return: bool; } // + //TIZEN_ONLY(20161114): make atspi proxy work for more than two sockets created in one process + @property socket_offset @protected { + set { + [[Sets position of socket offset.]] + } + get { + [[Gets position of socket offset.]] + } + values { + x: int; + y: int; + } + } + // } } diff --git a/src/lib/elementary/elm_atspi_bridge.c b/src/lib/elementary/elm_atspi_bridge.c index e395420..2da944e 100644 --- a/src/lib/elementary/elm_atspi_bridge.c +++ b/src/lib/elementary/elm_atspi_bridge.c @@ -2126,14 +2126,15 @@ static Eldbus_Message * _socket_offset_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) { int x, y; - Eo *bridge = _elm_atspi_bridge_get(); - ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, NULL); + Eo *parent; + Eo *obj = eldbus_service_object_data_get(iface, "_atspi_obj"); + parent = efl_parent_get(obj); + Evas_Object *top = elm_object_top_widget_get(parent); if (!eldbus_message_arguments_get(msg, "ii", &x, &y)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); - pd->socket_offset.x = x; - pd->socket_offset.y = y; + efl_access_component_socket_offset_set(top, x, y); return eldbus_message_method_return_new(msg); } @@ -3532,11 +3533,19 @@ _component_get_accessible_at_point(const Eldbus_Service_Interface *iface EINA_UN if (!eldbus_message_arguments_get(msg, "iiu", &x, &y, &coord_type)) return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); + // TIZEN_ONLY(20160705) - enable atspi_proxy to work - x = x - pd->socket_offset.x; - y = y - pd->socket_offset.y; + Evas_Object *top = elm_object_top_widget_get(obj); + int sx = 0; + int sy = 0; + + efl_access_component_socket_offset_get(top, &sx, &sy); + + x = x - sx; + y = y - sy; // + ret = eldbus_message_method_return_new(msg); EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); @@ -5205,7 +5214,7 @@ static const Eldbus_Property proxy_properties[] = { }; static const Eldbus_Service_Interface_Desc _proxy_iface_desc = { - ELM_ATSPI_DBUS_INTERFACE_PROXY, NULL, NULL, proxy_properties, NULL, NULL + ELM_ATSPI_DBUS_INTERFACE_PROXY, socket_methods, NULL, proxy_properties, NULL, NULL }; static void _embedded_reply_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) @@ -5265,44 +5274,6 @@ fail: efl_event_callback_call(proxy, ELM_ATSPI_PROXY_EVENT_DISCONNECTED, NULL); } -// TIZEN_ONLY(20160705) - enable atspi_proxy to work -static void -_offset_set_reply_cb(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *txt; - - if (eldbus_message_error_get(msg, &err, &txt)) - { - ERR("AT-SPI: SetOffset method call failed: %s %s", err, txt); - return; - } -} - -static void -_plug_offset_set_send(Eldbus_Connection *conn, const char *bus, const char *path, int x, int y) -{ - Eldbus_Message *msg = NULL; - - msg = eldbus_message_method_call_new(bus, path, ATSPI_DBUS_INTERFACE_SOCKET, "SetOffset"); - if (!msg) goto fail; - - if (!eldbus_message_arguments_append(msg, "i", x)) - goto fail; - - if (!eldbus_message_arguments_append(msg, "i", y)) - goto fail; - - if (!eldbus_connection_send(conn, msg, _offset_set_reply_cb, NULL, 100)) - goto fail; - - return; - -fail: - ERR("AT-SPI: Unable to send SetOffset request."); - if (msg) eldbus_message_unref(msg); -} -// - static void _socket_addr_get_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) { Eo *proxy = data; @@ -5323,7 +5294,7 @@ static void _socket_addr_get_cb(void *data, const Eldbus_Message *msg, Eldbus_Pe if (eldbus_message_error_get(msg, &err, &txt)) { ERR("Unable to connect to socket: %s %s", err, txt); - goto fail; + goto retry; } iter = eldbus_message_iter_get(msg); @@ -5353,6 +5324,10 @@ static void _socket_addr_get_cb(void *data, const Eldbus_Message *msg, Eldbus_Pe fail: efl_event_callback_call(proxy, ELM_ATSPI_PROXY_EVENT_DISCONNECTED, NULL); + return; + +retry: + elm_obj_atspi_proxy_address_get_retry_timer_add(proxy); } static void @@ -5576,6 +5551,19 @@ EAPI void elm_atspi_bridge_utils_proxy_listen(Eo *proxy) // // TIZEN_ONLY(20160705) - enable atspi_proxy to work +static void +_offset_set_reply_cb(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) +{ + const char *err, *txt; + + if (eldbus_message_error_get(msg, &err, &txt)) + { + ERR("AT-SPI: SetOffset method call failed: %s %s", err, txt); + return; + } +} + +// TIZEN_ONLY(20160705) - enable atspi_proxy to work void elm_atspi_bridge_utils_proxy_offset_set(Eo *proxy, int x, int y) { const char *bus, *path; @@ -5586,13 +5574,28 @@ void elm_atspi_bridge_utils_proxy_offset_set(Eo *proxy, int x, int y) if (!pd->a11y_bus) return; - elm_obj_atspi_proxy_address_get(proxy, &bus, &path); - if (!bus || !path) - { - ERR("AT-SPI: Elm_Atspi_Proxy bus or path not set."); - return; - } - _plug_offset_set_send(pd->a11y_bus, bus, path, x, y); + bus = efl_key_data_get(proxy, "__svc_bus"); + path = efl_key_data_get(proxy, "__svc_path"); + + Eldbus_Message *msg = NULL; + + msg = eldbus_message_method_call_new(bus, path, ELM_ATSPI_DBUS_INTERFACE_PROXY, "SetOffset"); + if (!msg) goto fail; + + if (!eldbus_message_arguments_append(msg, "i", x)) + goto fail; + + if (!eldbus_message_arguments_append(msg, "i", y)) + goto fail; + + if (!eldbus_connection_send(pd->a11y_bus, msg, _offset_set_reply_cb, NULL, 100)) + goto fail; + + return; + +fail: + ERR("AT-SPI: Unable to send SetOffset request."); + if (msg) eldbus_message_unref(msg); } //