summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-06-08 15:40:28 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-06-29 11:30:26 +0200
commit5de30c1ff61c96d9c9a1b44edb0a13ef5e54bf36 (patch)
tree955e9ee0abadee25fd73c3852193a747e016ce4f
parentec424b6893ef6c665fd351115b314a59865c0f6e (diff)
atspi: refactor atspi_bridge to eo object
This will allow to reuse eo events infrastructure in next patches.
-rw-r--r--src/lib/Elementary.h.in1
-rw-r--r--src/lib/Makefile.am2
-rw-r--r--src/lib/elm_atspi_bridge.c1390
-rw-r--r--src/lib/elm_atspi_bridge.eo26
-rw-r--r--src/lib/elm_atspi_bridge.h8
-rw-r--r--src/lib/elm_priv.h2
-rw-r--r--src/lib/elm_win.c7
7 files changed, 987 insertions, 449 deletions
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index cd17bbfd3..2dacb1a44 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -187,6 +187,7 @@ EAPI extern Elm_Version *elm_version;
187#include <elm_app_client_view.h> 187#include <elm_app_client_view.h>
188#include <elm_app.h> 188#include <elm_app.h>
189#include <elm_atspi_app_object.h> 189#include <elm_atspi_app_object.h>
190#include <elm_atspi_bridge.h>
190#include <elm_bg.h> 191#include <elm_bg.h>
191#include <elm_box.h> 192#include <elm_box.h>
192 193
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index de8574987..ece5597c5 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -532,6 +532,7 @@ elm_color_class.c: $(COLORCLASS_GEN)
532elm_eolian_files = \ 532elm_eolian_files = \
533elm_access.eo \ 533elm_access.eo \
534elm_actionslider.eo \ 534elm_actionslider.eo \
535elm_atspi_bridge.eo \
535elm_app_client.eo \ 536elm_app_client.eo \
536elm_app_client_view.eo \ 537elm_app_client_view.eo \
537elm_app_server.eo \ 538elm_app_server.eo \
@@ -679,6 +680,7 @@ elementaryeolianfiles_DATA = \
679 elm_app_server.eo \ 680 elm_app_server.eo \
680 elm_app_server_view.eo \ 681 elm_app_server_view.eo \
681 elm_atspi_app_object.eo \ 682 elm_atspi_app_object.eo \
683 elm_atspi_bridge.eo \
682 elm_interface_atspi_accessible.eo \ 684 elm_interface_atspi_accessible.eo \
683 elm_interface_atspi_action.eo \ 685 elm_interface_atspi_action.eo \
684 elm_interface_atspi_component.eo \ 686 elm_interface_atspi_component.eo \
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index c7a6a155b..44362c573 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -16,7 +16,6 @@
16#include <stdint.h> 16#include <stdint.h>
17#include <Elementary.h> 17#include <Elementary.h>
18#include "elm_priv.h" 18#include "elm_priv.h"
19#include <assert.h>
20 19
21/* 20/*
22 * Accessibility Bus info not defined in atspi-constants.h 21 * Accessibility Bus info not defined in atspi-constants.h
@@ -24,6 +23,7 @@
24#define A11Y_DBUS_NAME "org.a11y.Bus" 23#define A11Y_DBUS_NAME "org.a11y.Bus"
25#define A11Y_DBUS_PATH "/org/a11y/bus" 24#define A11Y_DBUS_PATH "/org/a11y/bus"
26#define A11Y_DBUS_INTERFACE "org.a11y.Bus" 25#define A11Y_DBUS_INTERFACE "org.a11y.Bus"
26#define A11Y_DBUS_STATUS_INTERFACE "org.a11y.Status"
27#define ATSPI_DBUS_INTERFACE_EVENT_WINDOW "org.a11y.atspi.Event.Window" 27#define ATSPI_DBUS_INTERFACE_EVENT_WINDOW "org.a11y.atspi.Event.Window"
28 28
29#define CACHE_ITEM_SIGNATURE "((so)(so)(so)a(so)assusau)" 29#define CACHE_ITEM_SIGNATURE "((so)(so)(so)a(so)assusau)"
@@ -34,29 +34,59 @@
34#define ELM_ACCESS_OBJECT_REFERENCE_TEMPLATE ELM_ACCESS_OBJECT_PATH_PREFIX "%llu" 34#define ELM_ACCESS_OBJECT_REFERENCE_TEMPLATE ELM_ACCESS_OBJECT_PATH_PREFIX "%llu"
35 35
36#define SIZE(x) sizeof(x)/sizeof(x[0]) 36#define SIZE(x) sizeof(x)/sizeof(x[0])
37#define ELM_ATSPI_BRIDGE_CLASS_NAME "__Elm_Atspi_Bridge"
38
39#define ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(obj, sd) \
40 Elm_Atspi_Bridge_Data *sd = eo_data_scope_get(obj, ELM_ATSPI_BRIDGE_CLASS); \
41 if (!sd) return;
42
43#define ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(obj, sd, val) \
44 Elm_Atspi_Bridge_Data *sd = eo_data_scope_get(obj, ELM_ATSPI_BRIDGE_CLASS); \
45 if (!sd) return val;
46
47#define ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, key, ifc, val) \
48 Eldbus_Service_Interface *ifc; \
49 eo_do(obj, ifc = eo_key_data_get(key)); \
50 if (!ifc) return val;
51
37 52
38typedef struct Key_Event_Info { 53typedef struct Key_Event_Info {
39 Ecore_Event_Key event; 54 Ecore_Event_Key event;
40 int type; 55 int type;
56 Eo *bridge;
41} Key_Event_Info; 57} Key_Event_Info;
42 58
59typedef struct _Elm_Atspi_Bridge_Data
60{
61 Eldbus_Connection *session_bus;
62 Eldbus_Connection *a11y_bus;
63 Eina_List *reemited_events;
64 Eo *root;
65 Eina_Hash *cache;
66 Eldbus_Service_Interface *cache_interface;
67 Eldbus_Signal_Handler *register_hdl;
68 Eldbus_Signal_Handler *unregister_hdl;
69 unsigned long object_broadcast_mask;
70 unsigned long object_property_broadcast_mask;
71 unsigned long object_children_broadcast_mask;
72 unsigned long long object_state_broadcast_mask;
73 unsigned long long window_signal_broadcast_mask;
74 Ecore_Event_Filter *key_flr;
75 Eldbus_Object *bus_obj;
76 Eina_List *pending_requests;
77
78 Eina_Bool connected : 1;
79} Elm_Atspi_Bridge_Data;
80
81struct cache_closure {
82 Eo *bridge;
83 Eldbus_Message_Iter *iter;
84};
85
86static Eo *_instance;
43static int _init_count = 0; 87static int _init_count = 0;
44static Eldbus_Connection *_a11y_bus = NULL;
45static Eina_List *reemited_events;
46static Eo *_root;
47static Ecore_Idler *_cache_update_idler;
48static Eina_List *_pending_objects;
49static Eina_Hash *_cache;
50static Eldbus_Service_Interface *_cache_interface = NULL;
51static Eldbus_Signal_Handler *_register_hdl;
52static Eldbus_Signal_Handler *_unregister_hdl;
53static unsigned long _object_broadcast_mask;
54static unsigned long _object_property_broadcast_mask;
55static unsigned long _object_children_broadcast_mask;
56static unsigned long long _object_state_broadcast_mask;
57static unsigned long long _window_signal_broadcast_mask;
58static Ecore_Event_Filter *_key_flr;
59 88
89// Object Event handlers
60static Eina_Bool _state_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info); 90static Eina_Bool _state_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
61static Eina_Bool _property_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info); 91static Eina_Bool _property_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info);
62static Eina_Bool _children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info); 92static Eina_Bool _children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info);
@@ -66,22 +96,28 @@ static Eina_Bool _text_text_inserted_send(void *data, Eo *obj, const Eo_Event_De
66static Eina_Bool _text_text_removed_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info); 96static Eina_Bool _text_text_removed_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
67static Eina_Bool _text_caret_moved_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info); 97static Eina_Bool _text_caret_moved_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
68static Eina_Bool _text_selection_changed_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED); 98static Eina_Bool _text_selection_changed_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED);
69static Eo * _access_object_from_path(const char *path); 99
70static char * _path_from_access_object(const Eo *eo); 100// bridge private methods
71static void _iter_object_reference_append(Eldbus_Message_Iter *iter, const Eo *obj); 101static void _bridge_cache_build(Eo *bridge, void *obj);
72static void _object_append_desktop_reference(Eldbus_Message_Iter *iter); 102static void _bridge_object_register(Eo *bridge, Eo *obj);
73static void _cache_build(void *obj); 103static void _bridge_object_unregister(Eo *bridge, Eo *obj);
74static void _object_register(Eo *obj, char *path); 104static char * _bridge_path_from_object(Eo *bridge, const Eo *eo);
105static void _bridge_signal_send(Eo *bridge, Eldbus_Service_Interface *infc, int signal, const char *minor, unsigned int det1, unsigned int det2, const char *variant_sig, ...);
106static Eo * _bridge_object_from_path(Eo *bridge, const char *path);
107static void _bridge_iter_object_reference_append(Eo *bridge, Eldbus_Message_Iter *iter, const Eo *obj);
108
109// utility functions
75static void _iter_interfaces_append(Eldbus_Message_Iter *iter, const Eo *obj); 110static void _iter_interfaces_append(Eldbus_Message_Iter *iter, const Eo *obj);
76static Eina_Bool _elm_atspi_bridge_key_filter(void *data, void *loop, int type, void *event); 111static Eina_Bool _elm_atspi_bridge_key_filter(void *data, void *loop, int type, void *event);
77static void _object_signal_send(Eldbus_Service_Interface *infc, int sig_id, const char *minor, unsigned int det1, unsigned int det2, const char *variant_sig, ...); 112static void _object_unregister(Eo *obj, void *data);
113static void _object_desktop_reference_append(Eldbus_Message_Iter *iter);
114static Eina_Bool _on_object_del(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED);
78 115
79EO_CALLBACKS_ARRAY_DEFINE(_events_cb, 116EO_CALLBACKS_ARRAY_DEFINE(_events_cb,
117 { EO_EV_DEL, _on_object_del},
80 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_PROPERTY_CHANGED, _property_changed_signal_send}, 118 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_PROPERTY_CHANGED, _property_changed_signal_send},
81 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_CHILDREN_CHANGED, _children_changed_signal_send}, 119 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_CHILDREN_CHANGED, _children_changed_signal_send},
82 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_STATE_CHANGED, _state_changed_signal_send}, 120 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_STATE_CHANGED, _state_changed_signal_send}
83 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_VISIBLE_DATA_CHANGED, NULL },
84 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_ACTIVE_DESCENDANTS_CHANGED, NULL }
85); 121);
86 122
87EO_CALLBACKS_ARRAY_DEFINE(_window_cb, 123EO_CALLBACKS_ARRAY_DEFINE(_window_cb,
@@ -102,9 +138,7 @@ EO_CALLBACKS_ARRAY_DEFINE(_text_cb,
102 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, _text_caret_moved_send }, 138 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, _text_caret_moved_send },
103 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_INSERTED, _text_text_inserted_send }, 139 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_INSERTED, _text_text_inserted_send },
104 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_REMOVED, _text_text_removed_send }, 140 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_REMOVED, _text_text_removed_send },
105 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_SELECTION_CHANGED, _text_selection_changed_send }, 141 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_SELECTION_CHANGED, _text_selection_changed_send }
106 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_BOUNDS_CHANGED, NULL },
107 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_ATTRIBUTES_CHANGED, NULL }
108); 142);
109 143
110enum _Atspi_Object_Child_Event_Type 144enum _Atspi_Object_Child_Event_Type
@@ -394,6 +428,11 @@ const int elm_relation_to_atspi_relation_mapping[] = {
394 [ELM_ATSPI_RELATION_LAST_DEFINED] = ATSPI_RELATION_LAST_DEFINED, 428 [ELM_ATSPI_RELATION_LAST_DEFINED] = ATSPI_RELATION_LAST_DEFINED,
395}; 429};
396 430
431static inline Eldbus_Message *_dbus_invalid_ref_error_new(const Eldbus_Message *msg)
432{
433 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
434}
435
397static AtspiRelationType _elm_relation_to_atspi_relation(Elm_Atspi_Relation_Type type) 436static AtspiRelationType _elm_relation_to_atspi_relation(Elm_Atspi_Relation_Type type)
398{ 437{
399 if ((type < ELM_ATSPI_RELATION_LAST_DEFINED) && (type > ELM_ATSPI_RELATION_NULL)) 438 if ((type < ELM_ATSPI_RELATION_LAST_DEFINED) && (type > ELM_ATSPI_RELATION_NULL))
@@ -405,10 +444,14 @@ static Eldbus_Message *
405_accessible_get_role(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 444_accessible_get_role(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
406{ 445{
407 const char *obj_path = eldbus_service_object_path_get(iface); 446 const char *obj_path = eldbus_service_object_path_get(iface);
408 Eo *obj = _access_object_from_path(obj_path); 447 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
448 Eo *obj = _bridge_object_from_path(bridge, obj_path);
409 AtspiRole atspi_role = ATSPI_ROLE_INVALID; 449 AtspiRole atspi_role = ATSPI_ROLE_INVALID;
410 Elm_Atspi_Role role; 450 Elm_Atspi_Role role;
411 451
452 if (!obj)
453 return _dbus_invalid_ref_error_new(msg);
454
412 eo_do(obj, role = elm_interface_atspi_accessible_role_get()); 455 eo_do(obj, role = elm_interface_atspi_accessible_role_get());
413 456
414 Eldbus_Message *ret = eldbus_message_method_return_new(msg); 457 Eldbus_Message *ret = eldbus_message_method_return_new(msg);
@@ -423,7 +466,11 @@ static Eldbus_Message *
423_accessible_get_role_name(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 466_accessible_get_role_name(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
424{ 467{
425 const char *role_name = NULL, *obj_path = eldbus_service_object_path_get(iface); 468 const char *role_name = NULL, *obj_path = eldbus_service_object_path_get(iface);
426 Eo *obj = _access_object_from_path(obj_path); 469 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
470 Eo *obj = _bridge_object_from_path(bridge, obj_path);
471
472 if (!obj)
473 return _dbus_invalid_ref_error_new(msg);
427 474
428 eo_do(obj, role_name = elm_interface_atspi_accessible_role_name_get()); 475 eo_do(obj, role_name = elm_interface_atspi_accessible_role_name_get());
429 476
@@ -438,9 +485,14 @@ static Eldbus_Message *
438_accessible_get_localized_role_name(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 485_accessible_get_localized_role_name(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
439{ 486{
440 const char *l_role_name = NULL, *obj_path = eldbus_service_object_path_get(iface); 487 const char *l_role_name = NULL, *obj_path = eldbus_service_object_path_get(iface);
441 Eo *obj = _access_object_from_path(obj_path); 488 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
489 Eo *obj = _bridge_object_from_path(bridge, obj_path);
490
491 if (!obj)
492 return _dbus_invalid_ref_error_new(msg);
442 493
443 eo_do(obj, l_role_name = elm_interface_atspi_accessible_localized_role_name_get()); 494 eo_do(obj, l_role_name = elm_interface_atspi_accessible_localized_role_name_get());
495 EINA_SAFETY_ON_NULL_RETURN_VAL(l_role_name, NULL);
444 496
445 Eldbus_Message *ret = eldbus_message_method_return_new(msg); 497 Eldbus_Message *ret = eldbus_message_method_return_new(msg);
446 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 498 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
@@ -453,13 +505,16 @@ static Eldbus_Message *
453_accessible_get_children(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 505_accessible_get_children(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
454{ 506{
455 const char *obj_path = eldbus_service_object_path_get(iface); 507 const char *obj_path = eldbus_service_object_path_get(iface);
456 Eo *obj = _access_object_from_path(obj_path); 508 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
509 Eo *obj = _bridge_object_from_path(bridge, obj_path);
457 Eina_List *children_list = NULL, *l; 510 Eina_List *children_list = NULL, *l;
458 Eldbus_Message *ret; 511 Eldbus_Message *ret;
459
460 Eldbus_Message_Iter *iter, *iter_array; 512 Eldbus_Message_Iter *iter, *iter_array;
461 Eo *children; 513 Eo *children;
462 514
515 if (!obj)
516 return _dbus_invalid_ref_error_new(msg);
517
463 eo_do(obj, children_list = elm_interface_atspi_accessible_children_get()); 518 eo_do(obj, children_list = elm_interface_atspi_accessible_children_get());
464 519
465 ret = eldbus_message_method_return_new(msg); 520 ret = eldbus_message_method_return_new(msg);
@@ -470,7 +525,7 @@ _accessible_get_children(const Eldbus_Service_Interface *iface, const Eldbus_Mes
470 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail); 525 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail);
471 526
472 EINA_LIST_FOREACH(children_list, l, children) 527 EINA_LIST_FOREACH(children_list, l, children)
473 _iter_object_reference_append(iter_array, children); 528 _bridge_iter_object_reference_append(bridge, iter_array, children);
474 529
475 eldbus_message_iter_container_close(iter, iter_array); 530 eldbus_message_iter_container_close(iter, iter_array);
476 eina_list_free(children_list); 531 eina_list_free(children_list);
@@ -483,12 +538,15 @@ fail:
483} 538}
484 539
485static Eldbus_Message * 540static Eldbus_Message *
486_accessible_get_application(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 541_accessible_get_application(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
487{ 542{
488 Eldbus_Message *ret = eldbus_message_method_return_new(msg); 543 Eldbus_Message *ret = eldbus_message_method_return_new(msg);
489 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 544 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
545
546 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
547
490 Eldbus_Message_Iter *iter = eldbus_message_iter_get(ret); 548 Eldbus_Message_Iter *iter = eldbus_message_iter_get(ret);
491 _iter_object_reference_append(iter, _root); 549 _bridge_iter_object_reference_append(bridge, iter, elm_atspi_bridge_root_get(bridge));
492 550
493 return ret; 551 return ret;
494} 552}
@@ -499,12 +557,17 @@ _accessible_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_M
499 Eina_List *attrs, *l; 557 Eina_List *attrs, *l;
500 Elm_Atspi_Attribute *attr; 558 Elm_Atspi_Attribute *attr;
501 Eldbus_Message_Iter *iter, *iter_dict, *iter_entry; 559 Eldbus_Message_Iter *iter, *iter_dict, *iter_entry;
502 560 Eldbus_Message *ret;
503 Eldbus_Message *ret = eldbus_message_method_return_new(msg);
504 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
505 561
506 const char *obj_path = eldbus_service_object_path_get(iface); 562 const char *obj_path = eldbus_service_object_path_get(iface);
507 Eo *obj = _access_object_from_path(obj_path); 563 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
564 Eo *obj = _bridge_object_from_path(bridge, obj_path);
565
566 if (!obj)
567 return _dbus_invalid_ref_error_new(msg);
568
569 ret = eldbus_message_method_return_new(msg);
570 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
508 571
509 eo_do(obj, attrs = elm_interface_atspi_accessible_attributes_get()); 572 eo_do(obj, attrs = elm_interface_atspi_accessible_attributes_get());
510 573
@@ -532,7 +595,11 @@ _accessible_interfaces_get(const Eldbus_Service_Interface *iface, const Eldbus_M
532 Eldbus_Message *ret; 595 Eldbus_Message *ret;
533 Eldbus_Message_Iter *iter; 596 Eldbus_Message_Iter *iter;
534 const char *obj_path = eldbus_service_object_path_get(iface); 597 const char *obj_path = eldbus_service_object_path_get(iface);
535 Eo *obj = _access_object_from_path(obj_path); 598 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
599 Eo *obj = _bridge_object_from_path(bridge, obj_path);
600
601 if (!obj)
602 return _dbus_invalid_ref_error_new(msg);
536 603
537 ret = eldbus_message_method_return_new(msg); 604 ret = eldbus_message_method_return_new(msg);
538 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 605 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
@@ -566,7 +633,8 @@ _accessible_get_state(const Eldbus_Service_Interface *iface, const Eldbus_Messag
566 uint64_t atspi_states = 0; 633 uint64_t atspi_states = 0;
567 634
568 const char *obj_path = eldbus_service_object_path_get(iface); 635 const char *obj_path = eldbus_service_object_path_get(iface);
569 Eo *obj = _access_object_from_path(obj_path); 636 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
637 Eo *obj = _bridge_object_from_path(bridge, obj_path);
570 638
571 if (!obj) 639 if (!obj)
572 { 640 {
@@ -603,10 +671,14 @@ static Eldbus_Message *
603_accessible_get_index_in_parent(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 671_accessible_get_index_in_parent(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
604{ 672{
605 const char *obj_path = eldbus_service_object_path_get(iface); 673 const char *obj_path = eldbus_service_object_path_get(iface);
606 Eo *obj = _access_object_from_path(obj_path); 674 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
675 Eo *obj = _bridge_object_from_path(bridge, obj_path);
607 Eldbus_Message *ret; 676 Eldbus_Message *ret;
608 int idx = -1; 677 int idx = -1;
609 678
679 if (!obj)
680 return _dbus_invalid_ref_error_new(msg);
681
610 ret = eldbus_message_method_return_new(msg); 682 ret = eldbus_message_method_return_new(msg);
611 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 683 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
612 684
@@ -621,13 +693,17 @@ static Eldbus_Message *
621_accessible_child_at_index(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 693_accessible_child_at_index(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
622{ 694{
623 const char *obj_path = eldbus_service_object_path_get(iface); 695 const char *obj_path = eldbus_service_object_path_get(iface);
624 Eo *obj = _access_object_from_path(obj_path); 696 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
697 Eo *obj = _bridge_object_from_path(bridge, obj_path);
625 Eo *child = NULL; 698 Eo *child = NULL;
626 Eina_List *children = NULL; 699 Eina_List *children = NULL;
627 int idx; 700 int idx;
628 Eldbus_Message *ret; 701 Eldbus_Message *ret;
629 Eldbus_Message_Iter *iter; 702 Eldbus_Message_Iter *iter;
630 703
704 if (!obj)
705 return _dbus_invalid_ref_error_new(msg);
706
631 if (!eldbus_message_arguments_get(msg, "i", &idx)) 707 if (!eldbus_message_arguments_get(msg, "i", &idx))
632 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 708 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
633 709
@@ -638,7 +714,7 @@ _accessible_child_at_index(const Eldbus_Service_Interface *iface EINA_UNUSED, co
638 eo_do(obj, children = elm_interface_atspi_accessible_children_get()); 714 eo_do(obj, children = elm_interface_atspi_accessible_children_get());
639 715
640 child = eina_list_nth(children, idx); 716 child = eina_list_nth(children, idx);
641 _iter_object_reference_append(iter, child); 717 _bridge_iter_object_reference_append(bridge, iter, child);
642 eina_list_free(children); 718 eina_list_free(children);
643 719
644 return ret; 720 return ret;
@@ -648,12 +724,16 @@ static Eldbus_Message *
648_accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 724_accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
649{ 725{
650 const char *obj_path = eldbus_service_object_path_get(iface); 726 const char *obj_path = eldbus_service_object_path_get(iface);
651 Eo *obj = _access_object_from_path(obj_path); 727 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
728 Eo *obj = _bridge_object_from_path(bridge, obj_path);
652 Eldbus_Message *ret = NULL; 729 Eldbus_Message *ret = NULL;
653 Eldbus_Message_Iter *iter = NULL, *iter_array = NULL, *iter_array2 = NULL, *iter_struct; 730 Eldbus_Message_Iter *iter = NULL, *iter_array = NULL, *iter_array2 = NULL, *iter_struct;
654 Elm_Atspi_Relation *rel; 731 Elm_Atspi_Relation *rel;
655 Eina_List *rels; 732 Eina_List *rels;
656 733
734 if (!obj)
735 return _dbus_invalid_ref_error_new(msg);
736
657 ret = eldbus_message_method_return_new(msg); 737 ret = eldbus_message_method_return_new(msg);
658 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 738 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
659 739
@@ -669,7 +749,7 @@ _accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED,
669 eldbus_message_iter_basic_append(iter_struct, 'u', _elm_relation_to_atspi_relation(rel->type)); 749 eldbus_message_iter_basic_append(iter_struct, 'u', _elm_relation_to_atspi_relation(rel->type));
670 iter_array2 = eldbus_message_iter_container_new(iter_struct, 'a', "(so)"); 750 iter_array2 = eldbus_message_iter_container_new(iter_struct, 'a', "(so)");
671 EINA_SAFETY_ON_NULL_GOTO(iter_array2, fail); 751 EINA_SAFETY_ON_NULL_GOTO(iter_array2, fail);
672 _iter_object_reference_append(iter_array2, rel->obj); 752 _bridge_iter_object_reference_append(bridge, iter_array2, rel->obj);
673 eldbus_message_iter_container_close(iter_struct, iter_array2); 753 eldbus_message_iter_container_close(iter_struct, iter_array2);
674 eldbus_message_iter_container_close(iter_array, iter_struct); 754 eldbus_message_iter_container_close(iter_array, iter_struct);
675 free(rel); 755 free(rel);
@@ -701,13 +781,17 @@ static Eldbus_Message *
701_selection_selected_child_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 781_selection_selected_child_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
702{ 782{
703 const char *obj_path = eldbus_service_object_path_get(iface); 783 const char *obj_path = eldbus_service_object_path_get(iface);
704 Eo *obj = _access_object_from_path(obj_path); 784 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
785 Eo *obj = _bridge_object_from_path(bridge, obj_path);
705 Eo *child = NULL; 786 Eo *child = NULL;
706 787
707 int idx; 788 int idx;
708 Eldbus_Message *ret; 789 Eldbus_Message *ret;
709 Eldbus_Message_Iter *iter; 790 Eldbus_Message_Iter *iter;
710 791
792 if (!obj)
793 return _dbus_invalid_ref_error_new(msg);
794
711 if (!eldbus_message_arguments_get(msg, "i", &idx)) 795 if (!eldbus_message_arguments_get(msg, "i", &idx))
712 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 796 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
713 797
@@ -717,7 +801,7 @@ _selection_selected_child_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
717 iter = eldbus_message_iter_get(ret); 801 iter = eldbus_message_iter_get(ret);
718 eo_do(obj, child = elm_interface_atspi_selection_selected_child_get(idx)); 802 eo_do(obj, child = elm_interface_atspi_selection_selected_child_get(idx));
719 803
720 _iter_object_reference_append(iter, child); 804 _bridge_iter_object_reference_append(bridge, iter, child);
721 805
722 return ret; 806 return ret;
723} 807}
@@ -726,11 +810,15 @@ static Eldbus_Message *
726_selection_child_select(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 810_selection_child_select(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
727{ 811{
728 const char *obj_path = eldbus_service_object_path_get(iface); 812 const char *obj_path = eldbus_service_object_path_get(iface);
729 Eo *obj = _access_object_from_path(obj_path); 813 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
814 Eo *obj = _bridge_object_from_path(bridge, obj_path);
730 int idx; 815 int idx;
731 Eldbus_Message *ret; 816 Eldbus_Message *ret;
732 Eina_Bool result; 817 Eina_Bool result;
733 818
819 if (!obj)
820 return _dbus_invalid_ref_error_new(msg);
821
734 if (!eldbus_message_arguments_get(msg, "i", &idx)) 822 if (!eldbus_message_arguments_get(msg, "i", &idx))
735 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 823 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
736 824
@@ -747,11 +835,15 @@ static Eldbus_Message *
747_selection_selected_child_deselect(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 835_selection_selected_child_deselect(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
748{ 836{
749 const char *obj_path = eldbus_service_object_path_get(iface); 837 const char *obj_path = eldbus_service_object_path_get(iface);
750 Eo *obj = _access_object_from_path(obj_path); 838 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
839 Eo *obj = _bridge_object_from_path(bridge, obj_path);
751 int idx; 840 int idx;
752 Eldbus_Message *ret; 841 Eldbus_Message *ret;
753 Eina_Bool result; 842 Eina_Bool result;
754 843
844 if (!obj)
845 return _dbus_invalid_ref_error_new(msg);
846
755 if (!eldbus_message_arguments_get(msg, "i", &idx)) 847 if (!eldbus_message_arguments_get(msg, "i", &idx))
756 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 848 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
757 849
@@ -768,11 +860,15 @@ static Eldbus_Message *
768_selection_is_child_selected(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 860_selection_is_child_selected(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
769{ 861{
770 const char *obj_path = eldbus_service_object_path_get(iface); 862 const char *obj_path = eldbus_service_object_path_get(iface);
771 Eo *obj = _access_object_from_path(obj_path); 863 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
864 Eo *obj = _bridge_object_from_path(bridge, obj_path);
772 int idx; 865 int idx;
773 Eldbus_Message *ret; 866 Eldbus_Message *ret;
774 Eina_Bool result; 867 Eina_Bool result;
775 868
869 if (!obj)
870 return _dbus_invalid_ref_error_new(msg);
871
776 if (!eldbus_message_arguments_get(msg, "i", &idx)) 872 if (!eldbus_message_arguments_get(msg, "i", &idx))
777 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 873 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
778 874
@@ -789,10 +885,14 @@ static Eldbus_Message *
789_selection_all_children_select(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 885_selection_all_children_select(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
790{ 886{
791 const char *obj_path = eldbus_service_object_path_get(iface); 887 const char *obj_path = eldbus_service_object_path_get(iface);
792 Eo *obj = _access_object_from_path(obj_path); 888 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
889 Eo *obj = _bridge_object_from_path(bridge, obj_path);
793 Eldbus_Message *ret; 890 Eldbus_Message *ret;
794 Eina_Bool result; 891 Eina_Bool result;
795 892
893 if (!obj)
894 return _dbus_invalid_ref_error_new(msg);
895
796 ret = eldbus_message_method_return_new(msg); 896 ret = eldbus_message_method_return_new(msg);
797 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 897 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
798 898
@@ -806,10 +906,14 @@ static Eldbus_Message *
806_selection_clear(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 906_selection_clear(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
807{ 907{
808 const char *obj_path = eldbus_service_object_path_get(iface); 908 const char *obj_path = eldbus_service_object_path_get(iface);
809 Eo *obj = _access_object_from_path(obj_path); 909 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
910 Eo *obj = _bridge_object_from_path(bridge, obj_path);
810 Eldbus_Message *ret; 911 Eldbus_Message *ret;
811 Eina_Bool result; 912 Eina_Bool result;
812 913
914 if (!obj)
915 return _dbus_invalid_ref_error_new(msg);
916
813 ret = eldbus_message_method_return_new(msg); 917 ret = eldbus_message_method_return_new(msg);
814 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 918 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
815 919
@@ -823,11 +927,15 @@ static Eldbus_Message *
823_selection_child_deselect(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 927_selection_child_deselect(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
824{ 928{
825 const char *obj_path = eldbus_service_object_path_get(iface); 929 const char *obj_path = eldbus_service_object_path_get(iface);
826 Eo *obj = _access_object_from_path(obj_path); 930 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
931 Eo *obj = _bridge_object_from_path(bridge, obj_path);
827 int idx; 932 int idx;
828 Eldbus_Message *ret; 933 Eldbus_Message *ret;
829 Eina_Bool result; 934 Eina_Bool result;
830 935
936 if (!obj)
937 return _dbus_invalid_ref_error_new(msg);
938
831 if (!eldbus_message_arguments_get(msg, "i", &idx)) 939 if (!eldbus_message_arguments_get(msg, "i", &idx))
832 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 940 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
833 941
@@ -855,10 +963,14 @@ static Eldbus_Message *
855_action_description_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 963_action_description_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
856{ 964{
857 const char *description, *obj_path = eldbus_service_object_path_get(iface); 965 const char *description, *obj_path = eldbus_service_object_path_get(iface);
858 Eo *obj = _access_object_from_path(obj_path); 966 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
967 Eo *obj = _bridge_object_from_path(bridge, obj_path);
859 int idx; 968 int idx;
860 Eldbus_Message *ret; 969 Eldbus_Message *ret;
861 970
971 if (!obj)
972 return _dbus_invalid_ref_error_new(msg);
973
862 if (!eldbus_message_arguments_get(msg, "i", &idx)) 974 if (!eldbus_message_arguments_get(msg, "i", &idx))
863 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 975 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
864 976
@@ -876,7 +988,8 @@ static Eldbus_Message *
876_action_name_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 988_action_name_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
877{ 989{
878 const char *name, *obj_path = eldbus_service_object_path_get(iface); 990 const char *name, *obj_path = eldbus_service_object_path_get(iface);
879 Eo *obj = _access_object_from_path(obj_path); 991 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
992 Eo *obj = _bridge_object_from_path(bridge, obj_path);
880 int idx; 993 int idx;
881 Eldbus_Message *ret; 994 Eldbus_Message *ret;
882 995
@@ -897,7 +1010,8 @@ static Eldbus_Message *
897_action_localized_name_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1010_action_localized_name_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
898{ 1011{
899 const char *name, *obj_path = eldbus_service_object_path_get(iface); 1012 const char *name, *obj_path = eldbus_service_object_path_get(iface);
900 Eo *obj = _access_object_from_path(obj_path); 1013 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1014 Eo *obj = _bridge_object_from_path(bridge, obj_path);
901 int idx; 1015 int idx;
902 Eldbus_Message *ret; 1016 Eldbus_Message *ret;
903 1017
@@ -919,7 +1033,8 @@ _action_key_binding_get(const Eldbus_Service_Interface *iface, const Eldbus_Mess
919{ 1033{
920 const char *obj_path = eldbus_service_object_path_get(iface); 1034 const char *obj_path = eldbus_service_object_path_get(iface);
921 char *key; 1035 char *key;
922 Eo *obj = _access_object_from_path(obj_path); 1036 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1037 Eo *obj = _bridge_object_from_path(bridge, obj_path);
923 int idx; 1038 int idx;
924 Eldbus_Message *ret; 1039 Eldbus_Message *ret;
925 1040
@@ -940,7 +1055,8 @@ static Eldbus_Message *
940_action_actions_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1055_action_actions_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
941{ 1056{
942 const char *action, *obj_path = eldbus_service_object_path_get(iface); 1057 const char *action, *obj_path = eldbus_service_object_path_get(iface);
943 Eo *obj = _access_object_from_path(obj_path); 1058 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1059 Eo *obj = _bridge_object_from_path(bridge, obj_path);
944 Eina_List *actions; 1060 Eina_List *actions;
945 Eldbus_Message *ret; 1061 Eldbus_Message *ret;
946 Eldbus_Message_Iter *iter, *iter_array; 1062 Eldbus_Message_Iter *iter, *iter_array;
@@ -978,11 +1094,15 @@ static Eldbus_Message *
978_action_action_do(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1094_action_action_do(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
979{ 1095{
980 const char *obj_path = eldbus_service_object_path_get(iface); 1096 const char *obj_path = eldbus_service_object_path_get(iface);
981 Eo *obj = _access_object_from_path(obj_path); 1097 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1098 Eo *obj = _bridge_object_from_path(bridge, obj_path);
982 int idx; 1099 int idx;
983 Eldbus_Message *ret; 1100 Eldbus_Message *ret;
984 Eina_Bool result; 1101 Eina_Bool result;
985 1102
1103 if (!obj)
1104 return _dbus_invalid_ref_error_new(msg);
1105
986 if (!eldbus_message_arguments_get(msg, "i", &idx)) 1106 if (!eldbus_message_arguments_get(msg, "i", &idx))
987 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 1107 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
988 1108
@@ -1013,10 +1133,14 @@ _image_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *
1013 const char *obj_path = eldbus_service_object_path_get(iface); 1133 const char *obj_path = eldbus_service_object_path_get(iface);
1014 int x, y, w, h; 1134 int x, y, w, h;
1015 Eina_Bool screen_coords; 1135 Eina_Bool screen_coords;
1016 Eo *obj = _access_object_from_path(obj_path); 1136 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1137 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1017 1138
1018 x = y = w = h = -1; 1139 x = y = w = h = -1;
1019 1140
1141 if (!obj)
1142 return _dbus_invalid_ref_error_new(msg);
1143
1020 if (!eldbus_message_arguments_get(msg, "u", &type)) 1144 if (!eldbus_message_arguments_get(msg, "u", &type))
1021 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 1145 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
1022 1146
@@ -1036,10 +1160,13 @@ _image_position_get(const Eldbus_Service_Interface *iface, const Eldbus_Message
1036 AtspiCoordType type; 1160 AtspiCoordType type;
1037 Eldbus_Message *ret; 1161 Eldbus_Message *ret;
1038 const char *obj_path = eldbus_service_object_path_get(iface); 1162 const char *obj_path = eldbus_service_object_path_get(iface);
1039 Eo *obj = _access_object_from_path(obj_path); 1163 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1164 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1040 int x = -1, y = -1; 1165 int x = -1, y = -1;
1041 Eina_Bool screen_coords; 1166 Eina_Bool screen_coords;
1042 1167
1168 if (!obj)
1169 return _dbus_invalid_ref_error_new(msg);
1043 if (!eldbus_message_arguments_get(msg, "u", &type)) 1170 if (!eldbus_message_arguments_get(msg, "u", &type))
1044 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type."); 1171 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Invalid index type.");
1045 1172
@@ -1059,9 +1186,12 @@ _image_size_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg
1059{ 1186{
1060 Eldbus_Message *ret; 1187 Eldbus_Message *ret;
1061 const char *obj_path = eldbus_service_object_path_get(iface); 1188 const char *obj_path = eldbus_service_object_path_get(iface);
1062 Eo *obj = _access_object_from_path(obj_path); 1189 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1190 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1063 int w = -1, h = -1; 1191 int w = -1, h = -1;
1064 1192
1193 if (!obj)
1194 return _dbus_invalid_ref_error_new(msg);
1065 ret = eldbus_message_method_return_new(msg); 1195 ret = eldbus_message_method_return_new(msg);
1066 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1196 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1067 1197
@@ -1087,7 +1217,11 @@ _text_string_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbus_M
1087 AtspiTextGranularity gran; 1217 AtspiTextGranularity gran;
1088 int start, end; 1218 int start, end;
1089 Eldbus_Message *ret; 1219 Eldbus_Message *ret;
1090 Eo *obj = _access_object_from_path(obj_path); 1220 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1221 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1222
1223 if (!obj)
1224 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1091 1225
1092 if (!eldbus_message_arguments_get(msg, "iu", &start, &gran)) 1226 if (!eldbus_message_arguments_get(msg, "iu", &start, &gran))
1093 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected."); 1227 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected.");
@@ -1109,9 +1243,13 @@ _text_text_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1109{ 1243{
1110 const char *obj_path = eldbus_service_object_path_get(iface); 1244 const char *obj_path = eldbus_service_object_path_get(iface);
1111 char *str; 1245 char *str;
1112 Eo *obj = _access_object_from_path(obj_path); 1246 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1247 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1113 int start, end; 1248 int start, end;
1114 1249
1250 if (!obj)
1251 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1252
1115 if (!eldbus_message_arguments_get(msg, "ii", &start, &end)) 1253 if (!eldbus_message_arguments_get(msg, "ii", &start, &end))
1116 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected."); 1254 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected.");
1117 1255
@@ -1131,11 +1269,15 @@ static Eldbus_Message *
1131_text_caret_offset_set(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1269_text_caret_offset_set(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1132{ 1270{
1133 const char *obj_path = eldbus_service_object_path_get(iface); 1271 const char *obj_path = eldbus_service_object_path_get(iface);
1134 Eo *obj = _access_object_from_path(obj_path); 1272 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1273 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1135 int offset; 1274 int offset;
1136 Eldbus_Message *ret; 1275 Eldbus_Message *ret;
1137 Eina_Bool res; 1276 Eina_Bool res;
1138 1277
1278 if (!obj)
1279 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1280
1139 if (!eldbus_message_arguments_get(msg, "i", &offset)) 1281 if (!eldbus_message_arguments_get(msg, "i", &offset))
1140 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1282 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
1141 1283
@@ -1153,11 +1295,15 @@ static Eldbus_Message *
1153_text_character_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1295_text_character_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1154{ 1296{
1155 const char *obj_path = eldbus_service_object_path_get(iface); 1297 const char *obj_path = eldbus_service_object_path_get(iface);
1156 Eo *obj = _access_object_from_path(obj_path); 1298 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1299 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1157 int offset; 1300 int offset;
1158 Eldbus_Message *ret; 1301 Eldbus_Message *ret;
1159 Eina_Unicode res; 1302 Eina_Unicode res;
1160 1303
1304 if (!obj)
1305 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1306
1161 if (!eldbus_message_arguments_get(msg, "i", &offset)) 1307 if (!eldbus_message_arguments_get(msg, "i", &offset))
1162 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1308 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
1163 1309
@@ -1176,11 +1322,15 @@ _text_attribute_value_get(const Eldbus_Service_Interface *iface, const Eldbus_Me
1176{ 1322{
1177 const char *name, *obj_path = eldbus_service_object_path_get(iface); 1323 const char *name, *obj_path = eldbus_service_object_path_get(iface);
1178 char *value = NULL; 1324 char *value = NULL;
1179 Eo *obj = _access_object_from_path(obj_path); 1325 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1326 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1180 int start, end; 1327 int start, end;
1181 Eldbus_Message *ret; 1328 Eldbus_Message *ret;
1182 Eina_Bool res; 1329 Eina_Bool res;
1183 1330
1331 if (!obj)
1332 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1333
1184 if (!eldbus_message_arguments_get(msg, "is", &start, &name)) 1334 if (!eldbus_message_arguments_get(msg, "is", &start, &name))
1185 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and attribute name expected."); 1335 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and attribute name expected.");
1186 1336
@@ -1198,13 +1348,17 @@ static Eldbus_Message *
1198_text_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1348_text_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1199{ 1349{
1200 const char *obj_path = eldbus_service_object_path_get(iface); 1350 const char *obj_path = eldbus_service_object_path_get(iface);
1201 Eo *obj = _access_object_from_path(obj_path); 1351 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1352 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1202 int start, end; 1353 int start, end;
1203 Eldbus_Message *ret; 1354 Eldbus_Message *ret;
1204 Eldbus_Message_Iter *iter, *iter_array; 1355 Eldbus_Message_Iter *iter, *iter_array;
1205 Eina_List *attrs; 1356 Eina_List *attrs;
1206 Elm_Atspi_Text_Attribute *attr; 1357 Elm_Atspi_Text_Attribute *attr;
1207 1358
1359 if (!obj)
1360 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1361
1208 if (!eldbus_message_arguments_get(msg, "i", &start)) 1362 if (!eldbus_message_arguments_get(msg, "i", &start))
1209 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1363 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
1210 1364
@@ -1237,13 +1391,17 @@ static Eldbus_Message *
1237_text_default_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1391_text_default_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1238{ 1392{
1239 const char *obj_path = eldbus_service_object_path_get(iface); 1393 const char *obj_path = eldbus_service_object_path_get(iface);
1240 Eo *obj = _access_object_from_path(obj_path); 1394 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1395 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1241 int start = -1, end; 1396 int start = -1, end;
1242 Eldbus_Message *ret; 1397 Eldbus_Message *ret;
1243 Eldbus_Message_Iter *iter, *iter_array; 1398 Eldbus_Message_Iter *iter, *iter_array;
1244 Eina_List *attrs; 1399 Eina_List *attrs;
1245 Elm_Atspi_Text_Attribute *attr; 1400 Elm_Atspi_Text_Attribute *attr;
1246 1401
1402 if (!obj)
1403 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1404
1247 ret = eldbus_message_method_return_new(msg); 1405 ret = eldbus_message_method_return_new(msg);
1248 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1406 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1249 1407
@@ -1273,13 +1431,17 @@ static Eldbus_Message *
1273_text_character_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1431_text_character_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1274{ 1432{
1275 const char *obj_path = eldbus_service_object_path_get(iface); 1433 const char *obj_path = eldbus_service_object_path_get(iface);
1276 Eo *obj = _access_object_from_path(obj_path); 1434 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1435 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1277 int offset; 1436 int offset;
1278 Eina_Rectangle rect; 1437 Eina_Rectangle rect;
1279 AtspiCoordType type; 1438 AtspiCoordType type;
1280 Eina_Bool screen_coords, res; 1439 Eina_Bool screen_coords, res;
1281 Eldbus_Message *ret; 1440 Eldbus_Message *ret;
1282 1441
1442 if (!obj)
1443 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1444
1283 if (!eldbus_message_arguments_get(msg, "iu", &offset, &type)) 1445 if (!eldbus_message_arguments_get(msg, "iu", &offset, &type))
1284 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected."); 1446 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected.");
1285 1447
@@ -1304,12 +1466,16 @@ static Eldbus_Message *
1304_text_offset_at_point_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1466_text_offset_at_point_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1305{ 1467{
1306 const char *obj_path = eldbus_service_object_path_get(iface); 1468 const char *obj_path = eldbus_service_object_path_get(iface);
1307 Eo *obj = _access_object_from_path(obj_path); 1469 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1470 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1308 int offset, x, y; 1471 int offset, x, y;
1309 AtspiCoordType type; 1472 AtspiCoordType type;
1310 Eina_Bool screen_coords; 1473 Eina_Bool screen_coords;
1311 Eldbus_Message *ret; 1474 Eldbus_Message *ret;
1312 1475
1476 if (!obj)
1477 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1478
1313 if (!eldbus_message_arguments_get(msg, "iiu", &x, &y, &type)) 1479 if (!eldbus_message_arguments_get(msg, "iiu", &x, &y, &type))
1314 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected."); 1480 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected.");
1315 1481
@@ -1330,10 +1496,14 @@ static Eldbus_Message *
1330_text_n_selections_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1496_text_n_selections_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1331{ 1497{
1332 const char *obj_path = eldbus_service_object_path_get(iface); 1498 const char *obj_path = eldbus_service_object_path_get(iface);
1333 Eo *obj = _access_object_from_path(obj_path); 1499 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1500 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1334 int n; 1501 int n;
1335 Eldbus_Message *ret; 1502 Eldbus_Message *ret;
1336 1503
1504 if (!obj)
1505 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1506
1337 ret = eldbus_message_method_return_new(msg); 1507 ret = eldbus_message_method_return_new(msg);
1338 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1508 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1339 1509
@@ -1348,10 +1518,14 @@ static Eldbus_Message *
1348_text_selection_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1518_text_selection_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1349{ 1519{
1350 const char *obj_path = eldbus_service_object_path_get(iface); 1520 const char *obj_path = eldbus_service_object_path_get(iface);
1351 Eo *obj = _access_object_from_path(obj_path); 1521 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1522 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1352 int sel_num, start, end; 1523 int sel_num, start, end;
1353 Eldbus_Message *ret; 1524 Eldbus_Message *ret;
1354 1525
1526 if (!obj)
1527 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1528
1355 if (!eldbus_message_arguments_get(msg, "i", &sel_num)) 1529 if (!eldbus_message_arguments_get(msg, "i", &sel_num))
1356 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 1530 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1357 1531
@@ -1369,11 +1543,15 @@ static Eldbus_Message *
1369_text_selection_add(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1543_text_selection_add(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1370{ 1544{
1371 const char *obj_path = eldbus_service_object_path_get(iface); 1545 const char *obj_path = eldbus_service_object_path_get(iface);
1372 Eo *obj = _access_object_from_path(obj_path); 1546 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1547 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1373 int start, end; 1548 int start, end;
1374 Eina_Bool res; 1549 Eina_Bool res;
1375 Eldbus_Message *ret; 1550 Eldbus_Message *ret;
1376 1551
1552 if (!obj)
1553 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1554
1377 if (!eldbus_message_arguments_get(msg, "ii", &start, &end)) 1555 if (!eldbus_message_arguments_get(msg, "ii", &start, &end))
1378 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end text offset expected."); 1556 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end text offset expected.");
1379 1557
@@ -1391,11 +1569,15 @@ static Eldbus_Message *
1391_text_selection_remove(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1569_text_selection_remove(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1392{ 1570{
1393 const char *obj_path = eldbus_service_object_path_get(iface); 1571 const char *obj_path = eldbus_service_object_path_get(iface);
1394 Eo *obj = _access_object_from_path(obj_path); 1572 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1573 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1395 int sel_num; 1574 int sel_num;
1396 Eina_Bool res; 1575 Eina_Bool res;
1397 Eldbus_Message *ret; 1576 Eldbus_Message *ret;
1398 1577
1578 if (!obj)
1579 return _dbus_invalid_ref_error_new(msg);
1580
1399 if (!eldbus_message_arguments_get(msg, "i", &sel_num)) 1581 if (!eldbus_message_arguments_get(msg, "i", &sel_num))
1400 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 1582 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1401 1583
@@ -1413,11 +1595,14 @@ static Eldbus_Message *
1413_text_selection_set(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1595_text_selection_set(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1414{ 1596{
1415 const char *obj_path = eldbus_service_object_path_get(iface); 1597 const char *obj_path = eldbus_service_object_path_get(iface);
1416 Eo *obj = _access_object_from_path(obj_path); 1598 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1599 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1417 int sel_num, start, end; 1600 int sel_num, start, end;
1418 Eina_Bool res; 1601 Eina_Bool res;
1419 Eldbus_Message *ret; 1602 Eldbus_Message *ret;
1420 1603
1604 if (!obj)
1605 return _dbus_invalid_ref_error_new(msg);
1421 if (!eldbus_message_arguments_get(msg, "iii", &sel_num, &start, &end)) 1606 if (!eldbus_message_arguments_get(msg, "iii", &sel_num, &start, &end))
1422 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 1607 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1423 1608
@@ -1435,13 +1620,16 @@ static Eldbus_Message *
1435_text_range_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1620_text_range_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1436{ 1621{
1437 const char *obj_path = eldbus_service_object_path_get(iface); 1622 const char *obj_path = eldbus_service_object_path_get(iface);
1438 Eo *obj = _access_object_from_path(obj_path); 1623 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1624 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1439 int start, end; 1625 int start, end;
1440 Eina_Rectangle rect; 1626 Eina_Rectangle rect;
1441 Eina_Bool screen_coords, res; 1627 Eina_Bool screen_coords, res;
1442 AtspiCoordType type; 1628 AtspiCoordType type;
1443 Eldbus_Message *ret; 1629 Eldbus_Message *ret;
1444 1630
1631 if (!obj)
1632 return _dbus_invalid_ref_error_new(msg);
1445 if (!eldbus_message_arguments_get(msg, "iiu", &start, &end, &type)) 1633 if (!eldbus_message_arguments_get(msg, "iiu", &start, &end, &type))
1446 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 1634 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1447 1635
@@ -1465,7 +1653,8 @@ static Eldbus_Message *
1465_text_bounded_ranges_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1653_text_bounded_ranges_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1466{ 1654{
1467 const char *obj_path = eldbus_service_object_path_get(iface); 1655 const char *obj_path = eldbus_service_object_path_get(iface);
1468 Eo *obj = _access_object_from_path(obj_path); 1656 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1657 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1469 Eina_Rectangle rect; 1658 Eina_Rectangle rect;
1470 Eina_Bool screen_coords; 1659 Eina_Bool screen_coords;
1471 AtspiCoordType type; 1660 AtspiCoordType type;
@@ -1476,6 +1665,8 @@ _text_bounded_ranges_get(const Eldbus_Service_Interface *iface, const Eldbus_Mes
1476 Elm_Atspi_Text_Range *range; 1665 Elm_Atspi_Text_Range *range;
1477 Eldbus_Message_Iter *iter, *iter_array, *iter_struct, *iter_var; 1666 Eldbus_Message_Iter *iter, *iter_array, *iter_struct, *iter_var;
1478 1667
1668 if (!obj)
1669 return _dbus_invalid_ref_error_new(msg);
1479 if (!eldbus_message_arguments_get(msg, "iiiiuuu", &rect.x, &rect.y, &rect.w, &rect.h, &type, &xc, &yc)) 1670 if (!eldbus_message_arguments_get(msg, "iiiiuuu", &rect.x, &rect.y, &rect.w, &rect.h, &type, &xc, &yc))
1480 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Expected (x,y,w,h) of bounding box, screen coord type and x, y text clip types."); 1671 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Expected (x,y,w,h) of bounding box, screen coord type and x, y text clip types.");
1481 1672
@@ -1529,7 +1720,8 @@ static Eldbus_Message *
1529_text_run_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1720_text_run_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1530{ 1721{
1531 const char *obj_path = eldbus_service_object_path_get(iface); 1722 const char *obj_path = eldbus_service_object_path_get(iface);
1532 Eo *obj = _access_object_from_path(obj_path); 1723 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1724 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1533 int start, end; 1725 int start, end;
1534 Eldbus_Message *ret; 1726 Eldbus_Message *ret;
1535 Eldbus_Message_Iter *iter, *iter_array; 1727 Eldbus_Message_Iter *iter, *iter_array;
@@ -1537,6 +1729,8 @@ _text_run_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Mes
1537 Elm_Atspi_Text_Attribute *attr; 1729 Elm_Atspi_Text_Attribute *attr;
1538 Eina_Bool incl_def; 1730 Eina_Bool incl_def;
1539 1731
1732 if (!obj)
1733 return _dbus_invalid_ref_error_new(msg);
1540 if (!eldbus_message_arguments_get(msg, "ib", &start, &incl_def)) 1734 if (!eldbus_message_arguments_get(msg, "ib", &start, &incl_def))
1541 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and include defaults flag expected."); 1735 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and include defaults flag expected.");
1542 1736
@@ -1597,11 +1791,14 @@ static Eldbus_Message *
1597_editable_text_text_content_set(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1791_editable_text_text_content_set(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1598{ 1792{
1599 const char *obj_path = eldbus_service_object_path_get(iface); 1793 const char *obj_path = eldbus_service_object_path_get(iface);
1600 Eo *obj = _access_object_from_path(obj_path); 1794 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1795 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1601 const char *content; 1796 const char *content;
1602 Eldbus_Message *ret; 1797 Eldbus_Message *ret;
1603 Eina_Bool res; 1798 Eina_Bool res;
1604 1799
1800 if (!obj)
1801 return _dbus_invalid_ref_error_new(msg);
1605 if (!eldbus_message_arguments_get(msg, "s", &content)) 1802 if (!eldbus_message_arguments_get(msg, "s", &content))
1606 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "String expected."); 1803 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "String expected.");
1607 1804
@@ -1619,7 +1816,8 @@ static Eldbus_Message *
1619_editable_text_text_insert(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1816_editable_text_text_insert(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1620{ 1817{
1621 const char *obj_path = eldbus_service_object_path_get(iface); 1818 const char *obj_path = eldbus_service_object_path_get(iface);
1622 Eo *obj = _access_object_from_path(obj_path); 1819 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1820 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1623 const char *text; 1821 const char *text;
1624 Eldbus_Message *ret; 1822 Eldbus_Message *ret;
1625 int pos, len; 1823 int pos, len;
@@ -1642,7 +1840,8 @@ static Eldbus_Message *
1642_editable_text_text_copy(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1840_editable_text_text_copy(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1643{ 1841{
1644 const char *obj_path = eldbus_service_object_path_get(iface); 1842 const char *obj_path = eldbus_service_object_path_get(iface);
1645 Eo *obj = _access_object_from_path(obj_path); 1843 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1844 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1646 Eldbus_Message *ret; 1845 Eldbus_Message *ret;
1647 int start, end; 1846 int start, end;
1648 Eina_Bool res; 1847 Eina_Bool res;
@@ -1664,7 +1863,8 @@ static Eldbus_Message *
1664_editable_text_text_cut(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1863_editable_text_text_cut(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1665{ 1864{
1666 const char *obj_path = eldbus_service_object_path_get(iface); 1865 const char *obj_path = eldbus_service_object_path_get(iface);
1667 Eo *obj = _access_object_from_path(obj_path); 1866 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1867 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1668 Eldbus_Message *ret; 1868 Eldbus_Message *ret;
1669 int start, end; 1869 int start, end;
1670 Eina_Bool res; 1870 Eina_Bool res;
@@ -1686,7 +1886,8 @@ static Eldbus_Message *
1686_editable_text_text_delete(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1886_editable_text_text_delete(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1687{ 1887{
1688 const char *obj_path = eldbus_service_object_path_get(iface); 1888 const char *obj_path = eldbus_service_object_path_get(iface);
1689 Eo *obj = _access_object_from_path(obj_path); 1889 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1890 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1690 Eldbus_Message *ret; 1891 Eldbus_Message *ret;
1691 int start, end; 1892 int start, end;
1692 Eina_Bool res; 1893 Eina_Bool res;
@@ -1708,7 +1909,8 @@ static Eldbus_Message *
1708_editable_text_text_paste(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) 1909_editable_text_text_paste(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1709{ 1910{
1710 const char *obj_path = eldbus_service_object_path_get(iface); 1911 const char *obj_path = eldbus_service_object_path_get(iface);
1711 Eo *obj = _access_object_from_path(obj_path); 1912 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1913 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1712 Eldbus_Message *ret; 1914 Eldbus_Message *ret;
1713 int pos; 1915 int pos;
1714 Eina_Bool res; 1916 Eina_Bool res;
@@ -1737,12 +1939,21 @@ static const Eldbus_Method editable_text_methods[] = {
1737}; 1939};
1738 1940
1739static Eo * 1941static Eo *
1740_access_object_from_path(const char *path) 1942_bridge_object_from_path(Eo *bridge, const char *path)
1741{ 1943{
1742 EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); 1944 EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
1743 unsigned long long eo_ptr = 0; 1945 unsigned long long eo_ptr = 0;
1744 Eo *eo = NULL; 1946 Eo *eo = NULL;
1745 const char *tmp = path; 1947 const char *tmp = path;
1948 Eo *ret;
1949
1950 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, NULL);
1951
1952 if (!eina_hash_find(pd->cache, path))
1953 {
1954 WRN("Request for nonexisting object: %s", path);
1955 return NULL;
1956 }
1746 1957
1747 int len = strlen(ELM_ACCESS_OBJECT_PATH_PREFIX); 1958 int len = strlen(ELM_ACCESS_OBJECT_PATH_PREFIX);
1748 1959
@@ -1751,23 +1962,25 @@ _access_object_from_path(const char *path)
1751 1962
1752 tmp = path + len; /* Skip over the prefix */ 1963 tmp = path + len; /* Skip over the prefix */
1753 if (!strcmp(ELM_ACCESS_OBJECT_PATH_ROOT, tmp)) 1964 if (!strcmp(ELM_ACCESS_OBJECT_PATH_ROOT, tmp))
1754 return _root; 1965 return elm_atspi_bridge_root_get(bridge);
1755 1966
1756 sscanf(tmp, "%llu", &eo_ptr); 1967 sscanf(tmp, "%llu", &eo_ptr);
1757 eo = (Eo *) (uintptr_t) eo_ptr; 1968 eo = (Eo *) (uintptr_t) eo_ptr;
1758 return eo_isa(eo, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN) ? eo : NULL; 1969 ret = eo_isa(eo, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN) ? eo : NULL;
1970 return ret;
1759} 1971}
1760 1972
1761static char * 1973static char *
1762_path_from_access_object(const Eo *eo) 1974_bridge_path_from_object(Eo *bridge, const Eo *eo)
1763{ 1975{
1764 char path[256]; 1976 char path[256];
1765 1977
1766 EINA_SAFETY_ON_NULL_RETURN_VAL(eo, strdup(ATSPI_DBUS_PATH_NULL)); 1978 EINA_SAFETY_ON_NULL_RETURN_VAL(eo, strdup(ATSPI_DBUS_PATH_NULL));
1767 if (eo == _root) 1979
1980 if (eo == elm_atspi_bridge_root_get(bridge))
1768 snprintf(path, sizeof(path), "%s%s", ELM_ACCESS_OBJECT_PATH_PREFIX, ELM_ACCESS_OBJECT_PATH_ROOT); 1981 snprintf(path, sizeof(path), "%s%s", ELM_ACCESS_OBJECT_PATH_PREFIX, ELM_ACCESS_OBJECT_PATH_ROOT);
1769 else 1982 else
1770 snprintf(path, sizeof(path), ELM_ACCESS_OBJECT_REFERENCE_TEMPLATE, (unsigned long long) (uintptr_t)eo); 1983 snprintf(path, sizeof(path), ELM_ACCESS_OBJECT_REFERENCE_TEMPLATE, (unsigned long long)(uintptr_t)eo);
1771 return strdup(path); 1984 return strdup(path);
1772} 1985}
1773 1986
@@ -1777,7 +1990,8 @@ _accessible_property_get(const Eldbus_Service_Interface *interface, const char *
1777 Eldbus_Message **error EINA_UNUSED) 1990 Eldbus_Message **error EINA_UNUSED)
1778{ 1991{
1779 const char *ret = NULL, *obj_path = eldbus_service_object_path_get(interface); 1992 const char *ret = NULL, *obj_path = eldbus_service_object_path_get(interface);
1780 Eo *ret_obj = NULL, *obj = _access_object_from_path(obj_path); 1993 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
1994 Eo *ret_obj = NULL, *obj = _bridge_object_from_path(bridge, obj_path);
1781 1995
1782 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); 1996 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1783 1997
@@ -1805,9 +2019,9 @@ _accessible_property_get(const Eldbus_Service_Interface *interface, const char *
1805 Elm_Atspi_Role role = ELM_ATSPI_ROLE_INVALID; 2019 Elm_Atspi_Role role = ELM_ATSPI_ROLE_INVALID;
1806 eo_do(obj, role = elm_interface_atspi_accessible_role_get()); 2020 eo_do(obj, role = elm_interface_atspi_accessible_role_get());
1807 if ((!ret_obj) && (ELM_ATSPI_ROLE_APPLICATION == role)) 2021 if ((!ret_obj) && (ELM_ATSPI_ROLE_APPLICATION == role))
1808 _object_append_desktop_reference(iter); 2022 _object_desktop_reference_append(iter);
1809 else 2023 else
1810 _iter_object_reference_append(iter, ret_obj); 2024 _bridge_iter_object_reference_append(bridge, iter, ret_obj);
1811 return EINA_TRUE; 2025 return EINA_TRUE;
1812 } 2026 }
1813 else if (!strcmp(property, "ChildCount")) 2027 else if (!strcmp(property, "ChildCount"))
@@ -1828,7 +2042,8 @@ _selection_property_get(const Eldbus_Service_Interface *interface, const char *p
1828{ 2042{
1829 int n; 2043 int n;
1830 const char *obj_path = eldbus_service_object_path_get(interface); 2044 const char *obj_path = eldbus_service_object_path_get(interface);
1831 Eo *obj = _access_object_from_path(obj_path); 2045 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2046 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1832 2047
1833 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); 2048 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1834 2049
@@ -1848,7 +2063,8 @@ _action_property_get(const Eldbus_Service_Interface *interface, const char *prop
1848{ 2063{
1849 Eina_List *actions; 2064 Eina_List *actions;
1850 const char *obj_path = eldbus_service_object_path_get(interface); 2065 const char *obj_path = eldbus_service_object_path_get(interface);
1851 Eo *obj = _access_object_from_path(obj_path); 2066 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2067 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1852 2068
1853 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); 2069 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1854 2070
@@ -1869,7 +2085,8 @@ _value_properties_set(const Eldbus_Service_Interface *interface, const char *pro
1869 double value; 2085 double value;
1870 Eina_Bool ret; 2086 Eina_Bool ret;
1871 const char *obj_path = eldbus_service_object_path_get(interface); 2087 const char *obj_path = eldbus_service_object_path_get(interface);
1872 Eo *obj = _access_object_from_path(obj_path); 2088 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2089 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1873 2090
1874 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); 2091 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1875 2092
@@ -1896,7 +2113,8 @@ _value_properties_get(const Eldbus_Service_Interface *interface, const char *pro
1896{ 2113{
1897 double value; 2114 double value;
1898 const char *obj_path = eldbus_service_object_path_get(interface); 2115 const char *obj_path = eldbus_service_object_path_get(interface);
1899 Eo *obj = _access_object_from_path(obj_path); 2116 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2117 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1900 2118
1901 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); 2119 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1902 2120
@@ -1934,7 +2152,8 @@ _image_properties_get(const Eldbus_Service_Interface *interface, const char *pro
1934{ 2152{
1935 const char *value; 2153 const char *value;
1936 const char *obj_path = eldbus_service_object_path_get(interface); 2154 const char *obj_path = eldbus_service_object_path_get(interface);
1937 Eo *obj = _access_object_from_path(obj_path); 2155 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2156 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1938 2157
1939 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); 2158 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1940 2159
@@ -1961,7 +2180,8 @@ _text_properties_get(const Eldbus_Service_Interface *interface, const char *prop
1961 Eldbus_Message **error EINA_UNUSED) 2180 Eldbus_Message **error EINA_UNUSED)
1962{ 2181{
1963 const char *obj_path = eldbus_service_object_path_get(interface); 2182 const char *obj_path = eldbus_service_object_path_get(interface);
1964 Eo *obj = _access_object_from_path(obj_path); 2183 Eo *bridge = eldbus_service_object_data_get(interface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2184 Eo *obj = _bridge_object_from_path(bridge, obj_path);
1965 int val; 2185 int val;
1966 2186
1967 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); 2187 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
@@ -1982,10 +2202,10 @@ _text_properties_get(const Eldbus_Service_Interface *interface, const char *prop
1982} 2202}
1983 2203
1984static const Eldbus_Property accessible_properties[] = { 2204static const Eldbus_Property accessible_properties[] = {
1985 { "Name", "s", _accessible_property_get, NULL, 0 }, 2205 { "Name", "s", NULL, NULL, 0 },
1986 { "Description", "s", _accessible_property_get, NULL, 0 }, 2206 { "Description", "s", NULL, NULL, 0 },
1987 { "Parent", "(so)", _accessible_property_get, NULL, 0 }, 2207 { "Parent", "(so)", NULL, NULL, 0 },
1988 { "ChildCount", "i", _accessible_property_get, NULL, 0 }, 2208 { "ChildCount", "i", NULL, NULL, 0 },
1989 { NULL, NULL, NULL, NULL, 0 } 2209 { NULL, NULL, NULL, NULL, 0 }
1990}; 2210};
1991 2211
@@ -2020,21 +2240,21 @@ static const Eldbus_Property text_properties[] = {
2020}; 2240};
2021 2241
2022static const Eldbus_Service_Interface_Desc accessible_iface_desc = { 2242static const Eldbus_Service_Interface_Desc accessible_iface_desc = {
2023 ATSPI_DBUS_INTERFACE_ACCESSIBLE, accessible_methods, NULL, accessible_properties, _accessible_property_get, NULL 2243 ATSPI_DBUS_INTERFACE_ACCESSIBLE, accessible_methods, _event_obj_signals, accessible_properties, _accessible_property_get, NULL
2024}; 2244};
2025 2245
2026static const Eldbus_Service_Interface_Desc event_iface_desc = { 2246static const Eldbus_Service_Interface_Desc event_iface_desc = {
2027 ATSPI_DBUS_INTERFACE_EVENT_OBJECT, NULL, _event_obj_signals, NULL, NULL, NULL 2247 ATSPI_DBUS_INTERFACE_EVENT_OBJECT, NULL, _event_obj_signals, NULL, NULL, NULL
2028}; 2248};
2029 2249
2030static const Eldbus_Service_Interface_Desc window_iface_desc = {
2031 ATSPI_DBUS_INTERFACE_EVENT_WINDOW, NULL, _window_obj_signals, NULL, NULL, NULL
2032};
2033
2034static const Eldbus_Service_Interface_Desc action_iface_desc = { 2250static const Eldbus_Service_Interface_Desc action_iface_desc = {
2035 ATSPI_DBUS_INTERFACE_ACTION, action_methods, NULL, action_properties, NULL, NULL 2251 ATSPI_DBUS_INTERFACE_ACTION, action_methods, NULL, action_properties, NULL, NULL
2036}; 2252};
2037 2253
2254static const Eldbus_Service_Interface_Desc window_iface_desc = {
2255 ATSPI_DBUS_INTERFACE_EVENT_WINDOW, NULL, _window_obj_signals, NULL, NULL, NULL
2256};
2257
2038static const Eldbus_Service_Interface_Desc value_iface_desc = { 2258static const Eldbus_Service_Interface_Desc value_iface_desc = {
2039 ATSPI_DBUS_INTERFACE_VALUE, NULL, NULL, value_properties, _value_properties_get, _value_properties_set 2259 ATSPI_DBUS_INTERFACE_VALUE, NULL, NULL, value_properties, _value_properties_get, _value_properties_set
2040}; 2260};
@@ -2056,19 +2276,20 @@ static const Eldbus_Service_Interface_Desc editable_text_iface_desc = {
2056}; 2276};
2057 2277
2058static void 2278static void
2059_iter_object_reference_append(Eldbus_Message_Iter *iter, const Eo *obj) 2279_bridge_iter_object_reference_append(Eo *bridge, Eldbus_Message_Iter *iter, const Eo *obj)
2060{ 2280{
2061 Eldbus_Message_Iter *iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL); 2281 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
2062 EINA_SAFETY_ON_NULL_RETURN(iter); 2282 Eldbus_Message_Iter *iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL);
2063 char *path = _path_from_access_object(obj); 2283 EINA_SAFETY_ON_NULL_RETURN(iter);
2064 eldbus_message_iter_basic_append(iter_struct, 's', eldbus_connection_unique_name_get(_a11y_bus)); 2284 char *path = _bridge_path_from_object(bridge, obj);
2065 eldbus_message_iter_basic_append(iter_struct, 'o', path); 2285 eldbus_message_iter_basic_append(iter_struct, 's', eldbus_connection_unique_name_get(pd->a11y_bus));
2066 eldbus_message_iter_container_close(iter, iter_struct); 2286 eldbus_message_iter_basic_append(iter_struct, 'o', path);
2067 free(path); 2287 eldbus_message_iter_container_close(iter, iter_struct);
2288 free(path);
2068} 2289}
2069 2290
2070static void 2291static void
2071_object_append_desktop_reference(Eldbus_Message_Iter *iter) 2292_object_desktop_reference_append(Eldbus_Message_Iter *iter)
2072{ 2293{
2073 Eldbus_Message_Iter *iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL); 2294 Eldbus_Message_Iter *iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL);
2074 EINA_SAFETY_ON_NULL_RETURN(iter); 2295 EINA_SAFETY_ON_NULL_RETURN(iter);
@@ -2106,15 +2327,17 @@ _iter_interfaces_append(Eldbus_Message_Iter *iter, const Eo *obj)
2106} 2327}
2107 2328
2108static Eina_Bool 2329static Eina_Bool
2109_append_item_fn(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata) 2330_cache_item_reference_append_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
2110{ 2331{
2111 if (!eo_ref_get(data) || eo_destructed_is(data)) 2332 if (!eo_ref_get(data) || eo_destructed_is(data))
2112 return EINA_TRUE; 2333 return EINA_TRUE;
2113 2334
2335 struct cache_closure *cl = fdata;
2114 Eldbus_Message_Iter *iter_struct, *iter_sub_array; 2336 Eldbus_Message_Iter *iter_struct, *iter_sub_array;
2115 Eldbus_Message_Iter *iter_array = fdata; 2337 Eldbus_Message_Iter *iter_array = cl->iter;
2116 Elm_Atspi_State_Set states; 2338 Elm_Atspi_State_Set states;
2117 Elm_Atspi_Role role; 2339 Elm_Atspi_Role role;
2340 Eo *root = elm_atspi_bridge_root_get(cl->bridge);
2118 2341
2119 eo_do(data, role = elm_interface_atspi_accessible_role_get()); 2342 eo_do(data, role = elm_interface_atspi_accessible_role_get());
2120 2343
@@ -2122,18 +2345,18 @@ _append_item_fn(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
2122 EINA_SAFETY_ON_NULL_RETURN_VAL(iter_struct, EINA_TRUE); 2345 EINA_SAFETY_ON_NULL_RETURN_VAL(iter_struct, EINA_TRUE);
2123 2346
2124 /* Marshall object path */ 2347 /* Marshall object path */
2125 _iter_object_reference_append(iter_struct, data); 2348 _bridge_iter_object_reference_append(cl->bridge, iter_struct, data);
2126 2349
2127 /* Marshall application */ 2350 /* Marshall application */
2128 _iter_object_reference_append(iter_struct, _root); 2351 _bridge_iter_object_reference_append(cl->bridge, iter_struct, root);
2129 2352
2130 Eo *parent = NULL; 2353 Eo *parent = NULL;
2131 eo_do(data, parent = elm_interface_atspi_accessible_parent_get()); 2354 eo_do(data, parent = elm_interface_atspi_accessible_parent_get());
2132 /* Marshall parent */ 2355 /* Marshall parent */
2133 if ((!parent) && (ELM_ATSPI_ROLE_APPLICATION == role)) 2356 if ((!parent) && (ELM_ATSPI_ROLE_APPLICATION == role))
2134 _object_append_desktop_reference(iter_struct); 2357 _object_desktop_reference_append(iter_struct);
2135 else 2358 else
2136 _iter_object_reference_append(iter_struct, parent); 2359 _bridge_iter_object_reference_append(cl->bridge, iter_struct, parent);
2137 2360
2138 /* Marshall children */ 2361 /* Marshall children */
2139 Eina_List *children_list = NULL, *l; 2362 Eina_List *children_list = NULL, *l;
@@ -2144,7 +2367,7 @@ _append_item_fn(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
2144 EINA_SAFETY_ON_NULL_GOTO(iter_sub_array, fail); 2367 EINA_SAFETY_ON_NULL_GOTO(iter_sub_array, fail);
2145 2368
2146 EINA_LIST_FOREACH(children_list, l, child) 2369 EINA_LIST_FOREACH(children_list, l, child)
2147 _iter_object_reference_append(iter_sub_array, child); 2370 _bridge_iter_object_reference_append(cl->bridge, iter_sub_array, child);
2148 2371
2149 eldbus_message_iter_container_close(iter_struct, iter_sub_array); 2372 eldbus_message_iter_container_close(iter_struct, iter_sub_array);
2150 eina_list_free(children_list); 2373 eina_list_free(children_list);
@@ -2193,18 +2416,28 @@ fail:
2193} 2416}
2194 2417
2195static Eldbus_Message * 2418static Eldbus_Message *
2196_cache_get_items(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2419_cache_get_items(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
2197{ 2420{
2198 Eldbus_Message_Iter *iter, *iter_array; 2421 Eldbus_Message_Iter *iter;
2199 Eldbus_Message *ret = eldbus_message_method_return_new(msg); 2422 Eldbus_Message *ret;
2423 struct cache_closure cl;
2424
2425 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2426 if (!bridge) return NULL;
2427
2428 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, NULL);
2429
2430 ret = eldbus_message_method_return_new(msg);
2200 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 2431 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
2201 2432
2202 iter = eldbus_message_iter_get(ret); 2433 iter = eldbus_message_iter_get(ret);
2203 iter_array = eldbus_message_iter_container_new(iter, 'a', CACHE_ITEM_SIGNATURE); 2434 cl.iter = eldbus_message_iter_container_new(iter, 'a', CACHE_ITEM_SIGNATURE);
2204 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail); 2435 EINA_SAFETY_ON_NULL_GOTO(cl.iter, fail);
2205 2436
2206 eina_hash_foreach(_cache, _append_item_fn, iter_array); 2437 cl.bridge = bridge;
2207 eldbus_message_iter_container_close(iter, iter_array); 2438
2439 eina_hash_foreach(pd->cache, _cache_item_reference_append_cb, &cl);
2440 eldbus_message_iter_container_close(iter, cl.iter);
2208 2441
2209 return ret; 2442 return ret;
2210fail: 2443fail:
@@ -2232,7 +2465,8 @@ static Eldbus_Message *
2232_component_contains(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2465_component_contains(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2233{ 2466{
2234 const char *obj_path = eldbus_service_object_path_get(iface); 2467 const char *obj_path = eldbus_service_object_path_get(iface);
2235 Eo *obj = _access_object_from_path(obj_path); 2468 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2469 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2236 int x, y; 2470 int x, y;
2237 Eina_Bool contains = EINA_FALSE; 2471 Eina_Bool contains = EINA_FALSE;
2238 AtspiCoordType coord_type; 2472 AtspiCoordType coord_type;
@@ -2256,7 +2490,8 @@ static Eldbus_Message *
2256_component_get_accessible_at_point(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2490_component_get_accessible_at_point(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2257{ 2491{
2258 const char *obj_path = eldbus_service_object_path_get(iface); 2492 const char *obj_path = eldbus_service_object_path_get(iface);
2259 Eo *obj = _access_object_from_path(obj_path); 2493 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2494 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2260 int x, y; 2495 int x, y;
2261 Eo *accessible = NULL; 2496 Eo *accessible = NULL;
2262 AtspiCoordType coord_type; 2497 AtspiCoordType coord_type;
@@ -2272,7 +2507,7 @@ _component_get_accessible_at_point(const Eldbus_Service_Interface *iface EINA_UN
2272 iter = eldbus_message_iter_get(ret); 2507 iter = eldbus_message_iter_get(ret);
2273 Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; 2508 Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE;
2274 eo_do(obj, accessible = elm_interface_atspi_component_accessible_at_point_get(type, x, y)); 2509 eo_do(obj, accessible = elm_interface_atspi_component_accessible_at_point_get(type, x, y));
2275 _iter_object_reference_append(iter, accessible); 2510 _bridge_iter_object_reference_append(bridge, iter, accessible);
2276 2511
2277 return ret; 2512 return ret;
2278} 2513}
@@ -2281,7 +2516,8 @@ static Eldbus_Message *
2281_component_get_extents(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2516_component_get_extents(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2282{ 2517{
2283 const char *obj_path = eldbus_service_object_path_get(iface); 2518 const char *obj_path = eldbus_service_object_path_get(iface);
2284 Eo *obj = _access_object_from_path(obj_path); 2519 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2520 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2285 int x, y, w, h; 2521 int x, y, w, h;
2286 AtspiCoordType coord_type; 2522 AtspiCoordType coord_type;
2287 Eldbus_Message *ret; 2523 Eldbus_Message *ret;
@@ -2316,7 +2552,8 @@ static Eldbus_Message *
2316_component_get_position(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2552_component_get_position(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2317{ 2553{
2318 const char *obj_path = eldbus_service_object_path_get(iface); 2554 const char *obj_path = eldbus_service_object_path_get(iface);
2319 Eo *obj = _access_object_from_path(obj_path); 2555 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2556 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2320 int x, y; 2557 int x, y;
2321 AtspiCoordType coord_type; 2558 AtspiCoordType coord_type;
2322 Eldbus_Message *ret; 2559 Eldbus_Message *ret;
@@ -2340,7 +2577,8 @@ static Eldbus_Message *
2340_component_get_size(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2577_component_get_size(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2341{ 2578{
2342 const char *obj_path = eldbus_service_object_path_get(iface); 2579 const char *obj_path = eldbus_service_object_path_get(iface);
2343 Eo *obj = _access_object_from_path(obj_path); 2580 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2581 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2344 int x, y; 2582 int x, y;
2345 Eldbus_Message *ret; 2583 Eldbus_Message *ret;
2346 2584
@@ -2369,7 +2607,8 @@ static Eldbus_Message *
2369_component_get_layer(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2607_component_get_layer(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2370{ 2608{
2371 const char *obj_path = eldbus_service_object_path_get(iface); 2609 const char *obj_path = eldbus_service_object_path_get(iface);
2372 Eo *obj = _access_object_from_path(obj_path); 2610 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2611 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2373 int layer = 0; 2612 int layer = 0;
2374 Eldbus_Message *ret; 2613 Eldbus_Message *ret;
2375 AtspiComponentLayer atspi_layer; 2614 AtspiComponentLayer atspi_layer;
@@ -2389,7 +2628,8 @@ static Eldbus_Message *
2389_component_grab_focus(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2628_component_grab_focus(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2390{ 2629{
2391 const char *obj_path = eldbus_service_object_path_get(iface); 2630 const char *obj_path = eldbus_service_object_path_get(iface);
2392 Eo *obj = _access_object_from_path(obj_path); 2631 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2632 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2393 Eldbus_Message *ret; 2633 Eldbus_Message *ret;
2394 Eina_Bool focus = EINA_FALSE; 2634 Eina_Bool focus = EINA_FALSE;
2395 2635
@@ -2407,7 +2647,8 @@ static Eldbus_Message *
2407_component_get_alpha(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2647_component_get_alpha(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2408{ 2648{
2409 const char *obj_path = eldbus_service_object_path_get(iface); 2649 const char *obj_path = eldbus_service_object_path_get(iface);
2410 Eo *obj = _access_object_from_path(obj_path); 2650 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2651 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2411 Eldbus_Message *ret; 2652 Eldbus_Message *ret;
2412 double alpha = 0; 2653 double alpha = 0;
2413 2654
@@ -2425,7 +2666,8 @@ static Eldbus_Message *
2425_component_set_extends(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2666_component_set_extends(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2426{ 2667{
2427 const char *obj_path = eldbus_service_object_path_get(iface); 2668 const char *obj_path = eldbus_service_object_path_get(iface);
2428 Eo *obj = _access_object_from_path(obj_path); 2669 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2670 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2429 int x, y, w, h; 2671 int x, y, w, h;
2430 AtspiCoordType coord_type; 2672 AtspiCoordType coord_type;
2431 Eldbus_Message *ret; 2673 Eldbus_Message *ret;
@@ -2449,7 +2691,8 @@ static Eldbus_Message *
2449_component_set_position(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2691_component_set_position(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2450{ 2692{
2451 const char *obj_path = eldbus_service_object_path_get(iface); 2693 const char *obj_path = eldbus_service_object_path_get(iface);
2452 Eo *obj = _access_object_from_path(obj_path); 2694 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2695 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2453 int x, y; 2696 int x, y;
2454 Eina_Bool result = EINA_FALSE; 2697 Eina_Bool result = EINA_FALSE;
2455 AtspiCoordType coord_type; 2698 AtspiCoordType coord_type;
@@ -2473,7 +2716,8 @@ static Eldbus_Message *
2473_component_set_size(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) 2716_component_set_size(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2474{ 2717{
2475 const char *obj_path = eldbus_service_object_path_get(iface); 2718 const char *obj_path = eldbus_service_object_path_get(iface);
2476 Eo *obj = _access_object_from_path(obj_path); 2719 Eo *bridge = eldbus_service_object_data_get(iface, ELM_ATSPI_BRIDGE_CLASS_NAME);
2720 Eo *obj = _bridge_object_from_path(bridge, obj_path);
2477 int w, h; 2721 int w, h;
2478 Eina_Bool result; 2722 Eina_Bool result;
2479 Eldbus_Message *ret; 2723 Eldbus_Message *ret;
@@ -2525,47 +2769,55 @@ _on_elm_atspi_bridge_app_register(void *data EINA_UNUSED, const Eldbus_Message *
2525} 2769}
2526 2770
2527EAPI Eina_Bool 2771EAPI Eina_Bool
2528_elm_atspi_bridge_app_register(void) 2772_elm_atspi_bridge_app_register(Eo *bridge)
2529{ 2773{
2530 if (!_a11y_bus || !_root) return EINA_FALSE; 2774 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, EINA_FALSE);
2775
2531 Eldbus_Message *message = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, 2776 Eldbus_Message *message = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY,
2532 ATSPI_DBUS_PATH_ROOT, 2777 ATSPI_DBUS_PATH_ROOT,
2533 ATSPI_DBUS_INTERFACE_SOCKET, 2778 ATSPI_DBUS_INTERFACE_SOCKET,
2534 "Embed"); 2779 "Embed");
2535 Eldbus_Message_Iter *iter = eldbus_message_iter_get(message); 2780 Eldbus_Message_Iter *iter = eldbus_message_iter_get(message);
2536 2781
2537 _iter_object_reference_append(iter, _root); 2782 _bridge_iter_object_reference_append(bridge, iter, elm_atspi_bridge_root_get(bridge));
2538 eldbus_connection_send(_a11y_bus, message, _on_elm_atspi_bridge_app_register, NULL, -1); 2783 eldbus_connection_send(pd->a11y_bus, message, _on_elm_atspi_bridge_app_register, NULL, -1);
2539 2784
2540 return EINA_TRUE; 2785 return EINA_TRUE;
2541} 2786}
2542 2787
2543EAPI Eina_Bool 2788EAPI Eina_Bool
2544_elm_atspi_bridge_app_unregister(void) 2789_elm_atspi_bridge_app_unregister(Eo *bridge)
2545{ 2790{
2546 if (!_a11y_bus || !_root) return EINA_FALSE; 2791 Eo *root;
2792 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, EINA_FALSE);
2793
2794 root = elm_atspi_bridge_root_get(bridge);
2795
2547 Eldbus_Message *message = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, 2796 Eldbus_Message *message = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY,
2548 ATSPI_DBUS_PATH_ROOT, 2797 ATSPI_DBUS_PATH_ROOT,
2549 ATSPI_DBUS_INTERFACE_SOCKET, 2798 ATSPI_DBUS_INTERFACE_SOCKET,
2550 "Unembed"); 2799 "Unembed");
2551 Eldbus_Message_Iter *iter = eldbus_message_iter_get(message); 2800 Eldbus_Message_Iter *iter = eldbus_message_iter_get(message);
2552 2801
2553 _iter_object_reference_append(iter, _root); 2802 _bridge_iter_object_reference_append(bridge, iter, root);
2554 eldbus_connection_send(_a11y_bus, message, NULL, NULL, -1); 2803 eldbus_connection_send(pd->a11y_bus, message, NULL, NULL, -1);
2555 2804
2556 return EINA_TRUE; 2805 return EINA_TRUE;
2557} 2806}
2558 2807
2559static void 2808static void
2560_cache_register(void) 2809_cache_register(Eo *obj)
2561{ 2810{
2562 _cache_interface = eldbus_service_interface_register(_a11y_bus, CACHE_INTERFACE_PATH, &cache_iface_desc); 2811 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(obj, ELM_ATSPI_BRIDGE_CLASS);
2812 pd->cache_interface = eldbus_service_interface_register(pd->a11y_bus, CACHE_INTERFACE_PATH, &cache_iface_desc);
2813 eldbus_service_object_data_set(pd->cache_interface, ELM_ATSPI_BRIDGE_CLASS_NAME, obj);
2563} 2814}
2564 2815
2565static void 2816static void
2566_set_broadcast_flag(const char *event) 2817_set_broadcast_flag(const char *event, Eo *bridge)
2567{ 2818{
2568 char **tokens; 2819 char **tokens;
2820 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(bridge, ELM_ATSPI_BRIDGE_CLASS);
2569 2821
2570 tokens = eina_str_split(event, ":", 3); 2822 tokens = eina_str_split(event, ":", 3);
2571 2823
@@ -2577,69 +2829,69 @@ _set_broadcast_flag(const char *event)
2577 else if (!strcmp(tokens[1], "StateChanged")) 2829 else if (!strcmp(tokens[1], "StateChanged"))
2578 { 2830 {
2579 if (!tokens[2] || *tokens[2] == '\0') 2831 if (!tokens[2] || *tokens[2] == '\0')
2580 _object_state_broadcast_mask = -1; // broadcast all 2832 pd->object_state_broadcast_mask = -1; // broadcast all
2581 else if (!strcmp(tokens[2], "Focused")) 2833 else if (!strcmp(tokens[2], "Focused"))
2582 STATE_TYPE_SET(_object_state_broadcast_mask, ATSPI_STATE_FOCUSED); 2834 STATE_TYPE_SET(pd->object_state_broadcast_mask, ATSPI_STATE_FOCUSED);
2583 else if (!strcmp(tokens[2], "Showing")) 2835 else if (!strcmp(tokens[2], "Showing"))
2584 STATE_TYPE_SET(_object_state_broadcast_mask, ATSPI_STATE_SHOWING); 2836 STATE_TYPE_SET(pd->object_state_broadcast_mask, ATSPI_STATE_SHOWING);
2585 else if (!strcmp(tokens[2], "Checked")) 2837 else if (!strcmp(tokens[2], "Checked"))
2586 STATE_TYPE_SET(_object_state_broadcast_mask, ATSPI_STATE_CHECKED); 2838 STATE_TYPE_SET(pd->object_state_broadcast_mask, ATSPI_STATE_CHECKED);
2587 } 2839 }
2588 else if (!strcmp(tokens[1], "PropertyChange")) 2840 else if (!strcmp(tokens[1], "PropertyChange"))
2589 { 2841 {
2590 if (!tokens[2] || *tokens[2] == '\0') 2842 if (!tokens[2] || *tokens[2] == '\0')
2591 _object_property_broadcast_mask = -1; //broadcast all 2843 pd->object_property_broadcast_mask = -1; //broadcast all
2592 else if (!strcmp(tokens[2], "AccessibleValue")) 2844 else if (!strcmp(tokens[2], "AccessibleValue"))
2593 STATE_TYPE_SET(_object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_VALUE); 2845 STATE_TYPE_SET(pd->object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_VALUE);
2594 else if (!strcmp(tokens[2], "AccessibleName")) 2846 else if (!strcmp(tokens[2], "AccessibleName"))
2595 STATE_TYPE_SET(_object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_NAME); 2847 STATE_TYPE_SET(pd->object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_NAME);
2596 else if (!strcmp(tokens[2], "AccessibleDescription")) 2848 else if (!strcmp(tokens[2], "AccessibleDescription"))
2597 STATE_TYPE_SET(_object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_DESCRIPTION); 2849 STATE_TYPE_SET(pd->object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_DESCRIPTION);
2598 else if (!strcmp(tokens[2], "AccessibleParent")) 2850 else if (!strcmp(tokens[2], "AccessibleParent"))
2599 STATE_TYPE_SET(_object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_PARENT); 2851 STATE_TYPE_SET(pd->object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_PARENT);
2600 else if (!strcmp(tokens[2], "AccessibleRole")) 2852 else if (!strcmp(tokens[2], "AccessibleRole"))
2601 STATE_TYPE_SET(_object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_ROLE); 2853 STATE_TYPE_SET(pd->object_property_broadcast_mask, ATSPI_OBJECT_PROPERTY_ROLE);
2602 } 2854 }
2603 else if (!strcmp(tokens[1], "ChildrenChanged")) 2855 else if (!strcmp(tokens[1], "ChildrenChanged"))
2604 { 2856 {
2605 if (!tokens[2] || *tokens[2] == '\0') 2857 if (!tokens[2] || *tokens[2] == '\0')
2606 _object_children_broadcast_mask = -1; // broadcast all 2858 pd->object_children_broadcast_mask = -1; // broadcast all
2607 else if (!strcmp(tokens[2], "add")) 2859 else if (!strcmp(tokens[2], "add"))
2608 STATE_TYPE_SET(_object_children_broadcast_mask, ATSPI_OBJECT_CHILD_ADDED); 2860 STATE_TYPE_SET(pd->object_children_broadcast_mask, ATSPI_OBJECT_CHILD_ADDED);
2609 else if (!strcmp(tokens[2], "remove")) 2861 else if (!strcmp(tokens[2], "remove"))
2610 STATE_TYPE_SET(_object_children_broadcast_mask, ATSPI_OBJECT_CHILD_ADDED); 2862 STATE_TYPE_SET(pd->object_children_broadcast_mask, ATSPI_OBJECT_CHILD_REMOVED);
2611 } 2863 }
2612 else if (!strcmp(tokens[1], "TextChanged")) 2864 else if (!strcmp(tokens[1], "TextChanged"))
2613 STATE_TYPE_SET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CHANGED); 2865 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CHANGED);
2614 else if (!strcmp(tokens[1], "TextCaretMoved")) 2866 else if (!strcmp(tokens[1], "TextCaretMoved"))
2615 STATE_TYPE_SET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CARET_MOVED); 2867 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CARET_MOVED);
2616 else if (!strcmp(tokens[1], "TextBoundsChanged")) 2868 else if (!strcmp(tokens[1], "TextBoundsChanged"))
2617 STATE_TYPE_SET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_BOUNDS_CHANGED); 2869 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_BOUNDS_CHANGED);
2618 else if (!strcmp(tokens[1], "TextSelectionChanged")) 2870 else if (!strcmp(tokens[1], "TextSelectionChanged"))
2619 STATE_TYPE_SET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_SELECTION_CHANGED); 2871 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_SELECTION_CHANGED);
2620 else if (!strcmp(tokens[1], "TextAttributesChanged")) 2872 else if (!strcmp(tokens[1], "TextAttributesChanged"))
2621 STATE_TYPE_SET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_ATTRIBUTES_CHANGED); 2873 STATE_TYPE_SET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_ATTRIBUTES_CHANGED);
2622 } 2874 }
2623 else if (!strcmp(tokens[0], "Window")) 2875 else if (!strcmp(tokens[0], "Window"))
2624 { 2876 {
2625 if (!tokens[1] || *tokens[1] == '\0') 2877 if (!tokens[1] || *tokens[1] == '\0')
2626 _window_signal_broadcast_mask = -1; // broadcast all 2878 pd->window_signal_broadcast_mask = -1; // broadcast all
2627 else if (!strcmp(tokens[1], "Create")) 2879 else if (!strcmp(tokens[1], "Create"))
2628 STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_CREATE); 2880 STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_CREATE);
2629 else if (!strcmp(tokens[1], "Destroy")) 2881 else if (!strcmp(tokens[1], "Destroy"))
2630 STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_DESTROY); 2882 STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_DESTROY);
2631 else if (!strcmp(tokens[1], "Activate")) 2883 else if (!strcmp(tokens[1], "Activate"))
2632 STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_ACTIVATE); 2884 STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_ACTIVATE);
2633 else if (!strcmp(tokens[1], "Deactivate")) 2885 else if (!strcmp(tokens[1], "Deactivate"))
2634 STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_DEACTIVATE); 2886 STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_DEACTIVATE);
2635 else if (!strcmp(tokens[1], "Maximize")) 2887 else if (!strcmp(tokens[1], "Maximize"))
2636 STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_MAXIMIZE); 2888 STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_MAXIMIZE);
2637 else if (!strcmp(tokens[1], "Minimize")) 2889 else if (!strcmp(tokens[1], "Minimize"))
2638 STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_MINIMIZE); 2890 STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_MINIMIZE);
2639 else if (!strcmp(tokens[1], "Resize")) 2891 else if (!strcmp(tokens[1], "Resize"))
2640 STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_RESIZE); 2892 STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_RESIZE);
2641 else if (!strcmp(tokens[1], "Restore")) 2893 else if (!strcmp(tokens[1], "Restore"))
2642 STATE_TYPE_SET(_window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_RESTORE); 2894 STATE_TYPE_SET(pd->window_signal_broadcast_mask, ATSPI_WINDOW_EVENT_RESTORE);
2643 } 2895 }
2644 2896
2645 free(tokens[0]); 2897 free(tokens[0]);
@@ -2647,16 +2899,24 @@ _set_broadcast_flag(const char *event)
2647} 2899}
2648 2900
2649static void 2901static void
2650_registered_listeners_get(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) 2902_registered_listeners_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
2651{ 2903{
2904 const char *event, *bus;
2905 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(data, ELM_ATSPI_BRIDGE_CLASS);
2906 pd->pending_requests = eina_list_remove(pd->pending_requests, pending);
2907
2652 DBG("Updating registered ATSPI signals list."); 2908 DBG("Updating registered ATSPI signals list.");
2653 _object_broadcast_mask = 0; 2909 pd->object_broadcast_mask = 0;
2654 _object_children_broadcast_mask = 0; 2910 pd->object_children_broadcast_mask = 0;
2655 _object_property_broadcast_mask = 0; 2911 pd->object_property_broadcast_mask = 0;
2656 _object_state_broadcast_mask = 0; 2912 pd->object_state_broadcast_mask = 0;
2657 _window_signal_broadcast_mask = 0; 2913 pd->window_signal_broadcast_mask = 0;
2658 2914
2659 const char *event, *bus; 2915 if (eldbus_message_error_get(msg, &event, &bus))
2916 {
2917 WRN("%s %s", event, bus);
2918 return;
2919 }
2660 Eldbus_Message_Iter *iter, *siter; 2920 Eldbus_Message_Iter *iter, *siter;
2661 if (!eldbus_message_arguments_get(msg, "a(ss)", &iter)) 2921 if (!eldbus_message_arguments_get(msg, "a(ss)", &iter))
2662 { 2922 {
@@ -2666,42 +2926,38 @@ _registered_listeners_get(void *data EINA_UNUSED, const Eldbus_Message *msg, Eld
2666 while (eldbus_message_iter_get_and_next(iter, 'r', &siter)) 2926 while (eldbus_message_iter_get_and_next(iter, 'r', &siter))
2667 { 2927 {
2668 eldbus_message_iter_arguments_get(siter, "ss", &bus, &event); 2928 eldbus_message_iter_arguments_get(siter, "ss", &bus, &event);
2669 _set_broadcast_flag(event); 2929 _set_broadcast_flag(event, data);
2670 } 2930 }
2671} 2931}
2672 2932
2673static void 2933static void
2674_registered_events_list_update(void) 2934_registered_events_list_update(Eo *bridge)
2675{ 2935{
2676 Eldbus_Message *msg; 2936 Eldbus_Message *msg;
2937 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(bridge, ELM_ATSPI_BRIDGE_CLASS);
2938 Eldbus_Pending *p;
2939
2677 msg = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "GetRegisteredEvents"); 2940 msg = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "GetRegisteredEvents");
2678 eldbus_connection_send(_a11y_bus, msg, _registered_listeners_get, NULL, -1); 2941 p = eldbus_connection_send(pd->a11y_bus, msg, _registered_listeners_get, bridge, -1);
2942 pd->pending_requests = eina_list_append(pd->pending_requests, p);
2679} 2943}
2680 2944
2681static void 2945static void
2682_handle_listener_change(void *data EINA_UNUSED, const Eldbus_Message *msg EINA_UNUSED) 2946_handle_listener_change(void *data, const Eldbus_Message *msg EINA_UNUSED)
2683{ 2947{
2684 _registered_events_list_update(); 2948 _registered_events_list_update(data);
2685} 2949}
2686 2950
2687static Eina_Bool 2951static Eina_Bool
2688_state_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) 2952_state_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
2689{ 2953{
2690 Eldbus_Service_Interface *events = data;
2691 Elm_Atspi_Event_State_Changed_Data *state_data = event_info; 2954 Elm_Atspi_Event_State_Changed_Data *state_data = event_info;
2692 char *type_desc; 2955 char *type_desc;
2956 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE);
2957 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc, EINA_FALSE);
2693 2958
2694 if (!STATE_TYPE_GET(_object_state_broadcast_mask, state_data->type)) 2959 if (!STATE_TYPE_GET(pd->object_state_broadcast_mask, state_data->type))
2695 { 2960 return EINA_FALSE;
2696 DBG("Masking event: %d", state_data->type);
2697 return EINA_FALSE;
2698 }
2699
2700 if (!events)
2701 {
2702 ERR("Atspi object does not have event interface!");
2703 return EINA_FALSE;
2704 }
2705 2961
2706 switch (state_data->type) { 2962 switch (state_data->type) {
2707 case ELM_ATSPI_STATE_FOCUSED: 2963 case ELM_ATSPI_STATE_FOCUSED:
@@ -2723,26 +2979,19 @@ _state_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descr
2723 return EINA_FALSE; 2979 return EINA_FALSE;
2724 } 2980 }
2725 2981
2726 _object_signal_send(events, ATSPI_OBJECT_EVENT_STATE_CHANGED, type_desc, state_data->new_value, 0, NULL); 2982 _bridge_signal_send(data, ifc, ATSPI_OBJECT_EVENT_STATE_CHANGED, type_desc, state_data->new_value, 0, NULL);
2727
2728 DBG("signal sent StateChanged:%s:%d", type_desc, state_data->new_value);
2729
2730 return EINA_TRUE; 2983 return EINA_TRUE;
2731} 2984}
2732 2985
2733static Eina_Bool 2986static Eina_Bool
2734_property_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) 2987_property_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
2735{ 2988{
2736 Eldbus_Service_Interface *events = data;
2737 const char *property = event_info; 2989 const char *property = event_info;
2738 char *atspi_desc; 2990 char *atspi_desc;
2739 enum _Atspi_Object_Property prop = ATSPI_OBJECT_PROPERTY_LAST; 2991 enum _Atspi_Object_Property prop = ATSPI_OBJECT_PROPERTY_LAST;
2740 2992
2741 if (!events) 2993 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE);
2742 { 2994 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc, EINA_FALSE);
2743 ERR("Atspi object does not have event interface!");
2744 return EINA_FALSE;
2745 }
2746 2995
2747 if (!strcmp(property, "parent")) 2996 if (!strcmp(property, "parent"))
2748 { 2997 {
@@ -2756,12 +3005,12 @@ _property_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_De
2756 } 3005 }
2757 else if (!strcmp(property, "description")) 3006 else if (!strcmp(property, "description"))
2758 { 3007 {
2759 prop = ATSPI_OBJECT_PROPERTY_PARENT; 3008 prop = ATSPI_OBJECT_PROPERTY_DESCRIPTION;
2760 atspi_desc = "accessible-description"; 3009 atspi_desc = "accessible-description";
2761 } 3010 }
2762 else if (!strcmp(property, "role")) 3011 else if (!strcmp(property, "role"))
2763 { 3012 {
2764 prop = ATSPI_OBJECT_PROPERTY_PARENT; 3013 prop = ATSPI_OBJECT_PROPERTY_ROLE;
2765 atspi_desc = "accessible-role"; 3014 atspi_desc = "accessible-role";
2766 } 3015 }
2767 else if (!strcmp(property, "value")) 3016 else if (!strcmp(property, "value"))
@@ -2774,45 +3023,36 @@ _property_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_De
2774 ERR("Unrecognized property name!"); 3023 ERR("Unrecognized property name!");
2775 return EINA_FALSE; 3024 return EINA_FALSE;
2776 } 3025 }
2777 if (!STATE_TYPE_GET(_object_property_broadcast_mask, prop)) 3026 if (!STATE_TYPE_GET(pd->object_property_broadcast_mask, prop))
2778 { 3027 {
2779 DBG("Masking property %s changed event.", property); 3028 DBG("Masking property %s changed event.", property);
2780 return EINA_FALSE; 3029 return EINA_FALSE;
2781 } 3030 }
2782 3031
2783 _object_signal_send(events, ATSPI_OBJECT_EVENT_PROPERTY_CHANGED, atspi_desc, 0, 0, NULL, NULL); 3032 _bridge_signal_send(data, ifc, ATSPI_OBJECT_EVENT_PROPERTY_CHANGED, atspi_desc, 0, 0, NULL, NULL);
2784
2785 DBG("signal sent PropertyChanged:%s", property);
2786
2787 return EINA_TRUE; 3033 return EINA_TRUE;
2788} 3034}
2789 3035
2790static Eina_Bool 3036static Eina_Bool
2791_children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) 3037_children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
2792{ 3038{
2793 Eldbus_Service_Interface *events = data;
2794 const char *atspi_desc = NULL; 3039 const char *atspi_desc = NULL;
2795 Elm_Atspi_Event_Children_Changed_Data *ev_data = event_info; 3040 Elm_Atspi_Event_Children_Changed_Data *ev_data = event_info;
2796 int idx; 3041 int idx;
2797 enum _Atspi_Object_Child_Event_Type type; 3042 enum _Atspi_Object_Child_Event_Type type;
2798 3043
3044 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE);
3045 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc, EINA_FALSE);
3046
2799 type = ev_data->is_added ? ATSPI_OBJECT_CHILD_ADDED : ATSPI_OBJECT_CHILD_REMOVED; 3047 type = ev_data->is_added ? ATSPI_OBJECT_CHILD_ADDED : ATSPI_OBJECT_CHILD_REMOVED;
2800 3048
2801 // update cached objects 3049 // update cached objects
2802 if (ev_data->is_added) 3050 if (ev_data->is_added)
2803 { 3051 _bridge_cache_build(data, ev_data->child);
2804 _cache_build(obj);
2805 }
2806 3052
2807 if (!STATE_TYPE_GET(_object_children_broadcast_mask, type)) 3053 if (!STATE_TYPE_GET(pd->object_children_broadcast_mask, type))
2808 return EINA_FALSE; 3054 return EINA_FALSE;
2809 3055
2810 if (!events)
2811 {
2812 ERR("Atspi object does not have event interface! %p %s", obj, eo_class_name_get(eo_class_get(obj)));
2813 return EINA_FALSE;
2814 }
2815
2816 switch (type) 3056 switch (type)
2817 { 3057 {
2818 case ATSPI_OBJECT_CHILD_ADDED: 3058 case ATSPI_OBJECT_CHILD_ADDED:
@@ -2821,91 +3061,94 @@ _children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *d
2821 break; 3061 break;
2822 case ATSPI_OBJECT_CHILD_REMOVED: 3062 case ATSPI_OBJECT_CHILD_REMOVED:
2823 atspi_desc = "remove"; 3063 atspi_desc = "remove";
2824 idx = -1; 3064 eo_do(ev_data->child, idx = elm_interface_atspi_accessible_index_in_parent_get());
2825 break; 3065 break;
2826 } 3066 }
2827 3067
2828 if (!atspi_desc) return EINA_FALSE; 3068 if (!atspi_desc) return EINA_FALSE;
2829 3069
2830 _object_signal_send(events, ATSPI_OBJECT_EVENT_CHILDREN_CHANGED, atspi_desc, idx, 0, "(so)", eldbus_connection_unique_name_get(_a11y_bus), ev_data->child); 3070 _bridge_signal_send(data, ifc, ATSPI_OBJECT_EVENT_CHILDREN_CHANGED, atspi_desc, idx, 0, "(so)", eldbus_connection_unique_name_get(pd->a11y_bus), ev_data->child);
2831
2832 DBG("signal sent childrenChanged:%s:%d", atspi_desc, idx);
2833 3071
2834 return EINA_TRUE; 3072 return EINA_TRUE;
2835} 3073}
2836 3074
2837static Eina_Bool 3075static Eina_Bool
2838_window_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc, void *event_info EINA_UNUSED) 3076_window_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED)
2839{ 3077{
2840 Eldbus_Service_Interface *window = data;
2841 enum _Atspi_Window_Signals type; 3078 enum _Atspi_Window_Signals type;
3079 const char *name;
3080
3081 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE);
3082 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, eo_class_name_get(ELM_INTERFACE_ATSPI_WINDOW_INTERFACE), ifc, EINA_FALSE);
2842 3083
2843 if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED) 3084 if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_CREATED)
2844 type = ATSPI_WINDOW_EVENT_CREATE; 3085 {
3086 type = ATSPI_WINDOW_EVENT_CREATE;
3087 name = "Create";
3088 }
2845 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED) 3089 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DESTROYED)
2846 type = ATSPI_WINDOW_EVENT_DESTROY; 3090 {
3091 type = ATSPI_WINDOW_EVENT_DESTROY;
3092 name = "Destroy";
3093 }
2847 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED) 3094 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_DEACTIVATED)
2848 type = ATSPI_WINDOW_EVENT_DEACTIVATE; 3095 {
3096 type = ATSPI_WINDOW_EVENT_DEACTIVATE;
3097 name = "Deactivate";
3098 }
2849 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_ACTIVATED) 3099 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_ACTIVATED)
2850 type = ATSPI_WINDOW_EVENT_ACTIVATE; 3100 {
3101 type = ATSPI_WINDOW_EVENT_ACTIVATE;
3102 name = "Activate";
3103 }
2851 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MAXIMIZED) 3104 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MAXIMIZED)
2852 type = ATSPI_WINDOW_EVENT_MAXIMIZE; 3105 {
3106 type = ATSPI_WINDOW_EVENT_MAXIMIZE;
3107 name = "Maximize";
3108 }
2853 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MINIMIZED) 3109 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_MINIMIZED)
2854 type = ATSPI_WINDOW_EVENT_MINIMIZE; 3110 {
3111 type = ATSPI_WINDOW_EVENT_MINIMIZE;
3112 name = "Minimize";
3113 }
2855 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_RESTORED) 3114 else if (desc == ELM_INTERFACE_ATSPI_WINDOW_EVENT_WINDOW_RESTORED)
2856 type = ATSPI_WINDOW_EVENT_RESTORE; 3115 {
3116 type = ATSPI_WINDOW_EVENT_RESTORE;
3117 name = "Restore";
3118 }
2857 else 3119 else
2858 return EINA_FALSE; 3120 return EINA_FALSE;
2859 3121
2860 if (!STATE_TYPE_GET(_window_signal_broadcast_mask, type)) 3122 if (!STATE_TYPE_GET(pd->window_signal_broadcast_mask, type))
2861 return EINA_FALSE; 3123 return EINA_FALSE;
2862 3124
2863 if (!window || !_a11y_bus) 3125 if (!pd->a11y_bus)
2864 { 3126 {
2865 ERR("A11Y connection closed. Unable to send ATSPI event."); 3127 ERR("A11Y connection closed. Unable to send ATSPI event.");
2866 return EINA_FALSE; 3128 return EINA_FALSE;
2867 } 3129 }
2868 3130
2869 _object_signal_send(window, type, "", 0, 0, "i", 0); 3131 _bridge_signal_send(data, ifc, type, name, 0, 0, "i", 0);
2870
2871 DBG("sent signal org.a11y.atspi.Window:%d", type);
2872
2873 return EINA_TRUE; 3132 return EINA_TRUE;
2874} 3133}
2875 3134
2876static Eina_Bool 3135static Eina_Bool
2877_selection_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc, void *event_info EINA_UNUSED) 3136_selection_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
2878{ 3137{
2879 const char *event_desc; 3138 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_TRUE);
2880 Eldbus_Service_Interface *selection = data; 3139 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc, EINA_FALSE);
2881 3140
2882 enum _Atspi_Object_Signals type; 3141 if (!STATE_TYPE_GET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_SELECTION_CHANGED))
2883 if (desc == ELM_INTERFACE_ATSPI_SELECTION_EVENT_SELECTION_CHANGED) 3142 return EINA_FALSE;
2884 {
2885 event_desc = "SelectionChanged";
2886 type = ATSPI_OBJECT_EVENT_SELECTION_CHANGED;
2887 }
2888 else
2889 {
2890 WRN("ATSPI Selection event not handled");
2891 return EINA_FALSE;
2892 }
2893
2894 if (!selection || !_a11y_bus)
2895 {
2896 ERR("A11Y connection closed. Unable to send ATSPI event.");
2897 return EINA_FALSE;
2898 }
2899
2900 _object_signal_send(selection, type, event_desc, 0, 0, "i", 0);
2901 3143
3144 _bridge_signal_send(data, ifc, ATSPI_OBJECT_EVENT_SELECTION_CHANGED, "", 0, 0, "i", 0);
2902 return EINA_TRUE; 3145 return EINA_TRUE;
2903} 3146}
2904 3147
2905static void _object_signal_send(Eldbus_Service_Interface *infc, int sig_id, const char *minor, unsigned int det1, unsigned int det2, const char *variant_sig, ...) 3148static void _bridge_signal_send(Eo *bridge, Eldbus_Service_Interface *infc, int signal, const char *minor, unsigned int det1, unsigned int det2, const char *variant_sig, ...)
2906{ 3149{
2907 Eldbus_Message *msg; 3150 Eldbus_Message *msg;
2908 Eldbus_Message_Iter *iter , *iter_stack[64]; 3151 Eldbus_Message_Iter *iter , *iter_stack[64], *iter_struct;
2909 va_list va; 3152 va_list va;
2910 Eo *atspi_obj; 3153 Eo *atspi_obj;
2911 char *path; 3154 char *path;
@@ -2913,9 +3156,10 @@ static void _object_signal_send(Eldbus_Service_Interface *infc, int sig_id, cons
2913 3156
2914 EINA_SAFETY_ON_NULL_RETURN(infc); 3157 EINA_SAFETY_ON_NULL_RETURN(infc);
2915 EINA_SAFETY_ON_NULL_RETURN(minor); 3158 EINA_SAFETY_ON_NULL_RETURN(minor);
3159 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
2916 3160
2917 msg = eldbus_service_signal_new(infc, sig_id); 3161 msg = eldbus_service_signal_new(infc, signal);
2918 EINA_SAFETY_ON_NULL_RETURN(msg); 3162 if (!msg) return;
2919 3163
2920 va_start(va, variant_sig); 3164 va_start(va, variant_sig);
2921 3165
@@ -2943,7 +3187,7 @@ static void _object_signal_send(Eldbus_Service_Interface *infc, int sig_id, cons
2943 break; 3187 break;
2944 case 'o': 3188 case 'o':
2945 atspi_obj = va_arg(va, Eo*); 3189 atspi_obj = va_arg(va, Eo*);
2946 path = _path_from_access_object(atspi_obj); 3190 path = _bridge_path_from_object(bridge, atspi_obj);
2947 eldbus_message_iter_basic_append(iter_stack[top], 'o', path); 3191 eldbus_message_iter_basic_append(iter_stack[top], 'o', path);
2948 free(path); 3192 free(path);
2949 break; 3193 break;
@@ -2970,265 +3214,437 @@ static void _object_signal_send(Eldbus_Service_Interface *infc, int sig_id, cons
2970 3214
2971 eldbus_message_iter_container_close(iter, iter_stack[0]); 3215 eldbus_message_iter_container_close(iter, iter_stack[0]);
2972 3216
2973 _iter_object_reference_append(iter, _root); 3217 iter_struct = eldbus_message_iter_container_new(iter, 'r', NULL);
3218 path = _bridge_path_from_object(bridge, elm_atspi_bridge_root_get(bridge));
3219 eldbus_message_iter_basic_append(iter_struct, 's', eldbus_connection_unique_name_get(pd->a11y_bus));
3220 eldbus_message_iter_basic_append(iter_struct, 'o', path);
3221 eldbus_message_iter_container_close(iter, iter_struct);
3222 free(path);
2974 3223
2975 eldbus_service_signal_send(infc, msg); 3224 if (eldbus_service_signal_send(infc, msg))
3225 DBG("Signal send::[%s,%d,%d]", minor, det1, det2);
2976} 3226}
2977 3227
2978static Eina_Bool 3228static Eina_Bool
2979_text_caret_moved_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) 3229_text_caret_moved_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
2980{ 3230{
2981 Eldbus_Service_Interface *event = data;
2982 int cursor_pos = 0; 3231 int cursor_pos = 0;
2983 3232
2984 EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_TRUE); 3233 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE);
3234 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc, EINA_FALSE);
2985 3235
2986 if (!STATE_TYPE_GET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CARET_MOVED)) 3236 if (!STATE_TYPE_GET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CARET_MOVED))
2987 return EINA_TRUE; 3237 return EINA_TRUE;
2988 3238
2989 eo_do(obj, cursor_pos = elm_interface_atspi_text_caret_offset_get()); 3239 eo_do(obj, cursor_pos = elm_interface_atspi_text_caret_offset_get());
2990 3240
2991 _object_signal_send(event, ATSPI_OBJECT_EVENT_TEXT_CARET_MOVED, "", cursor_pos, 0, NULL, NULL); 3241 _bridge_signal_send(data, ifc, ATSPI_OBJECT_EVENT_TEXT_CARET_MOVED, "", cursor_pos, 0, NULL, NULL);
3242
2992 return EINA_TRUE; 3243 return EINA_TRUE;
2993} 3244}
2994 3245
2995static Eina_Bool 3246static Eina_Bool
2996_text_text_inserted_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) 3247_text_text_inserted_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
2997{ 3248{
2998 Eldbus_Service_Interface *event = data;
2999 Elm_Atspi_Text_Change_Info *info = event_info; 3249 Elm_Atspi_Text_Change_Info *info = event_info;
3000 3250
3001 EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_TRUE); 3251 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_TRUE);
3002 EINA_SAFETY_ON_NULL_RETURN_VAL(event_info, EINA_TRUE); 3252 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc, EINA_FALSE);
3003 3253
3004 if (!STATE_TYPE_GET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CHANGED)) 3254 if (!STATE_TYPE_GET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CHANGED))
3005 return EINA_TRUE; 3255 return EINA_TRUE;
3006 3256
3007 _object_signal_send(event, ATSPI_OBJECT_EVENT_TEXT_CHANGED, "insert", info->pos, info->len, "s", info->content); 3257 _bridge_signal_send(data, ifc, ATSPI_OBJECT_EVENT_TEXT_CHANGED, "insert", info->pos, info->len, "s", info->content);
3008 3258
3009 return EINA_TRUE; 3259 return EINA_TRUE;
3010} 3260}
3011 3261
3012static Eina_Bool 3262static Eina_Bool
3013_text_text_removed_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) 3263_text_text_removed_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
3014{ 3264{
3015 Eldbus_Service_Interface *event = data;
3016 Elm_Atspi_Text_Change_Info *info = event_info; 3265 Elm_Atspi_Text_Change_Info *info = event_info;
3017 3266
3018 EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_TRUE); 3267 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_TRUE);
3019 EINA_SAFETY_ON_NULL_RETURN_VAL(event_info, EINA_TRUE); 3268 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc, EINA_FALSE);
3020 3269
3021 if (!STATE_TYPE_GET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CHANGED)) 3270 if (!STATE_TYPE_GET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_CHANGED))
3022 return EINA_TRUE; 3271 return EINA_TRUE;
3023 3272
3024 _object_signal_send(event, ATSPI_OBJECT_EVENT_TEXT_CHANGED, "delete", info->pos, info->len, "s", info->content); 3273 _bridge_signal_send(data, ifc, ATSPI_OBJECT_EVENT_TEXT_CHANGED, "delete", info->pos, info->len, "s", info->content);
3025 3274
3026 return EINA_TRUE; 3275 return EINA_TRUE;
3027} 3276}
3028 3277
3029static Eina_Bool 3278static Eina_Bool
3030_text_selection_changed_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) 3279_text_selection_changed_send(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
3031{ 3280{
3032 Eldbus_Service_Interface *event = data; 3281 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_TRUE);
3282 ELM_ATSPI_OBJECT_INTERFACE_GET_OR_RETURN_VAL(obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc, EINA_FALSE);
3033 3283
3034 EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_TRUE); 3284 if (!STATE_TYPE_GET(pd->object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_SELECTION_CHANGED))
3035
3036 if (!STATE_TYPE_GET(_object_broadcast_mask, ATSPI_OBJECT_EVENT_TEXT_SELECTION_CHANGED))
3037 return EINA_TRUE; 3285 return EINA_TRUE;
3038 3286
3039 _object_signal_send(event, ATSPI_OBJECT_EVENT_TEXT_SELECTION_CHANGED, "", 0, 0, NULL, NULL); 3287 _bridge_signal_send(data, ifc, ATSPI_OBJECT_EVENT_TEXT_SELECTION_CHANGED, "", 0, 0, NULL, NULL);
3040 3288
3041 return EINA_TRUE; 3289 return EINA_TRUE;
3042} 3290}
3043 3291
3044static void 3292static void
3045_event_handlers_register(void) 3293_event_handlers_register(Eo *bridge)
3046{ 3294{
3047 _registered_events_list_update(); 3295 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(bridge, ELM_ATSPI_BRIDGE_CLASS);
3296
3297 _registered_events_list_update(bridge);
3048 3298
3049 // register signal handlers in order to update list of registered listeners of ATSPI-Clients 3299 // register signal handlers in order to update list of registered listeners of ATSPI-Clients
3050 _register_hdl = eldbus_signal_handler_add(_a11y_bus, ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "EventListenerRegistered", _handle_listener_change, NULL); 3300 pd->register_hdl = eldbus_signal_handler_add(pd->a11y_bus, ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "EventListenerRegistered", _handle_listener_change, bridge);
3051 _unregister_hdl = eldbus_signal_handler_add(_a11y_bus, ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "EventListenerDeregistered", _handle_listener_change, NULL); 3301 pd->unregister_hdl = eldbus_signal_handler_add(pd->a11y_bus, ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_REGISTRY, ATSPI_DBUS_INTERFACE_REGISTRY, "EventListenerDeregistered", _handle_listener_change, bridge);
3052 3302
3053 _key_flr = ecore_event_filter_add(NULL, _elm_atspi_bridge_key_filter, NULL, NULL); 3303 pd->key_flr = ecore_event_filter_add(NULL, _elm_atspi_bridge_key_filter, NULL, bridge);
3054} 3304}
3055 3305
3056static Eina_Bool 3306static void
3057_on_cache_item_del(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED) 3307_bridge_object_unregister(Eo *bridge, Eo *obj)
3058{ 3308{
3059 char *path; 3309 char *path;
3060 path = _path_from_access_object(obj); 3310 Eldbus_Message *sig;
3061 eina_hash_del(_cache, path, obj); 3311
3312 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
3313
3314 _object_unregister(obj, bridge);
3315
3316 sig = eldbus_service_signal_new(pd->cache_interface, ATSPI_OBJECT_CHILD_REMOVED);
3317 Eldbus_Message_Iter *iter = eldbus_message_iter_get(sig);
3318 _bridge_iter_object_reference_append(bridge, iter, obj);
3319 eldbus_service_signal_send(pd->cache_interface, sig);
3320
3321 path = _bridge_path_from_object(bridge, obj);
3322 eina_hash_del(pd->cache, path, obj);
3062 free(path); 3323 free(path);
3324}
3325
3326static Eina_Bool
3327_on_object_del(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED)
3328{
3329 Eo *bridge = data;
3330
3331 _bridge_object_unregister(bridge, obj);
3063 3332
3064 return EINA_TRUE; 3333 return EINA_TRUE;
3065} 3334}
3066 3335
3067static void 3336static void
3068_cache_build(void *obj) 3337_bridge_cache_build(Eo *bridge, void *obj)
3069{ 3338{
3070 Eina_List *children; 3339 Eina_List *children;
3071 Eo *child; 3340 Eo *child;
3072 char *path = NULL; 3341
3342 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
3073 3343
3074 if (!eo_isa(obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN)) 3344 if (!eo_isa(obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
3075 return; 3345 return;
3076 3346
3077 path = _path_from_access_object(obj); 3347 _bridge_object_register(bridge, obj);
3078 if (!eina_hash_find(_cache, path))
3079 {
3080 eina_hash_add(_cache, path, obj);
3081 _object_register(obj, path);
3082 eo_do(obj, eo_event_callback_add(EO_EV_DEL, _on_cache_item_del, NULL));
3083 }
3084 free(path);
3085 3348
3086 eo_do(obj, children = elm_interface_atspi_accessible_children_get()); 3349 eo_do(obj, children = elm_interface_atspi_accessible_children_get());
3087 EINA_LIST_FREE(children, child) 3350 EINA_LIST_FREE(children, child)
3088 _cache_build(child); 3351 _bridge_cache_build(bridge, child);
3352}
3353
3354static Eina_Bool _unregister_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
3355{
3356 _object_unregister(data, fdata);
3357 return EINA_TRUE;
3089} 3358}
3090 3359
3091static void 3360static void
3092_a11y_bus_initialize(const char *socket_addr) 3361_a11y_connection_shutdown(Eo *bridge)
3093{ 3362{
3094 _a11y_bus = eldbus_address_connection_get(socket_addr); 3363 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(bridge, ELM_ATSPI_BRIDGE_CLASS);
3364 Eldbus_Pending *pending;
3365
3366 if (pd->connected)
3367 _elm_atspi_bridge_app_unregister(bridge);
3095 3368
3096 _cache_register(); 3369 if (pd->cache)
3097 _event_handlers_register(); 3370 {
3098 _elm_atspi_bridge_app_register(); 3371 eina_hash_foreach(pd->cache, _unregister_cb, bridge);
3099 _cache_build(_root); 3372 eina_hash_free(pd->cache);
3373 }
3374 pd->cache = NULL;
3375
3376 if (pd->cache_interface)
3377 eldbus_service_object_unregister(pd->cache_interface);
3378
3379 if (pd->key_flr) ecore_event_filter_del(pd->key_flr);
3380 pd->key_flr = NULL;
3381
3382 if (pd->register_hdl) eldbus_signal_handler_del(pd->register_hdl);
3383 pd->register_hdl = NULL;
3384
3385 if (pd->unregister_hdl) eldbus_signal_handler_del(pd->unregister_hdl);
3386 pd->unregister_hdl = NULL;
3387
3388 EINA_LIST_FREE(pd->pending_requests, pending)
3389 eldbus_pending_cancel(pending);
3390 pd->pending_requests = NULL;
3391
3392 if (pd->a11y_bus) eldbus_connection_unref(pd->a11y_bus);
3393 pd->a11y_bus = NULL;
3394
3395 pd->connected = EINA_FALSE;
3396}
3397
3398static void _disconnect_cb(void *data, Eldbus_Connection *conn EINA_UNUSED, void *event_info EINA_UNUSED)
3399{
3400 _a11y_connection_shutdown(data);
3100} 3401}
3101 3402
3102static void 3403static void
3103_a11y_bus_address_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) 3404_a11y_bus_initialize(Eo *obj, const char *socket_addr)
3405{
3406 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(obj, ELM_ATSPI_BRIDGE_CLASS);
3407 Eo *root;
3408
3409 pd->a11y_bus = eldbus_private_address_connection_get(socket_addr);
3410 if (!pd->a11y_bus)
3411 return;
3412
3413 eldbus_connection_event_callback_add(pd->a11y_bus, ELDBUS_CONNECTION_EVENT_DISCONNECTED, _disconnect_cb, obj);
3414
3415 // init data structures
3416 pd->cache = eina_hash_string_superfast_new(NULL);
3417
3418 // register interfaces
3419 _cache_register(obj);
3420 _event_handlers_register(obj);
3421 _elm_atspi_bridge_app_register(obj);
3422
3423 // buid cache
3424 eo_do(obj, root = elm_obj_atspi_bridge_root_get());
3425 _bridge_cache_build(obj, root);
3426
3427 pd->connected = EINA_TRUE;
3428}
3429
3430static void
3431_a11y_bus_address_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
3104{ 3432{
3105 const char *errname, *errmsg, *sock_addr = NULL; 3433 const char *errname, *errmsg, *sock_addr = NULL;
3106 Eldbus_Connection *session_bus = data; 3434 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(data, ELM_ATSPI_BRIDGE_CLASS);
3435
3436 pd->pending_requests = eina_list_remove(pd->pending_requests, pending);
3107 3437
3108 if (eldbus_message_error_get(msg, &errname, &errmsg)) 3438 if (eldbus_message_error_get(msg, &errname, &errmsg))
3109 { 3439 {
3110 ERR("%s %s", errname, errmsg); 3440 ERR("%s %s", errname, errmsg);
3111 goto end; 3441 return;
3112 } 3442 }
3113 3443
3114 if (!eldbus_message_arguments_get(msg, "s", &sock_addr) || !sock_addr) 3444 if (!eldbus_message_arguments_get(msg, "s", &sock_addr) || !sock_addr)
3115 { 3445 {
3116 ERR("Could not get A11Y Bus socket address."); 3446 ERR("Could not get A11Y Bus socket address.");
3117 goto end; 3447 return;
3118 } 3448 }
3119 3449
3120 _a11y_bus_initialize(sock_addr); 3450 _a11y_bus_initialize((Eo*)data, sock_addr);
3451}
3452
3453static void _a11y_connection_init(Eo *bridge)
3454{
3455 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(bridge, ELM_ATSPI_BRIDGE_CLASS);
3456 Eina_Bool is_connected;
3457
3458 eo_do(bridge, is_connected = elm_obj_atspi_bridge_connected_get());
3121 3459
3122end: 3460 if (is_connected) return;
3123 eldbus_connection_unref(session_bus); 3461
3462 Eldbus_Message *m = eldbus_object_method_call_new(pd->bus_obj, A11Y_DBUS_INTERFACE, "GetAddress");
3463 Eldbus_Pending *p = eldbus_object_send(pd->bus_obj, m, _a11y_bus_address_get, bridge, 100);
3464
3465 if (p)
3466 pd->pending_requests = eina_list_append(pd->pending_requests, p);
3124} 3467}
3125 3468
3126static void _object_register(Eo *obj, char *path) 3469static void
3470_screen_reader_enabled_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
3127{ 3471{
3128 Eldbus_Service_Interface *infc = NULL, *event_infc; 3472 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(data, ELM_ATSPI_BRIDGE_CLASS);
3473 const char *errname, *errmsg;
3474 Eina_Bool is_enabled;
3475 Eldbus_Message_Iter *variant;
3129 3476
3130 if (!eo_isa(obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN)) 3477 pd->pending_requests = eina_list_remove(pd->pending_requests, pending);
3478
3479 if (eldbus_message_error_get(msg, &errname, &errmsg))
3131 { 3480 {
3132 WRN("Unable to register class w/o Elm_Interface_Atspi_Accessible!"); 3481 WRN("%s %s", errname, errmsg);
3133 return; 3482 return;
3134 } 3483 }
3135 3484 if (!eldbus_message_arguments_get(msg, "v", &variant))
3136 if (_a11y_bus)
3137 { 3485 {
3138 eldbus_service_interface_register(_a11y_bus, path, &accessible_iface_desc); 3486 ERR("'ScreenReaderEnabled' not packed into variant.");
3139 3487 return;
3140 event_infc = eldbus_service_interface_register(_a11y_bus, path, &event_iface_desc); 3488 }
3141 eo_do(obj, eo_key_data_set("event_interface", event_infc)); 3489 if (!eldbus_message_iter_arguments_get(variant, "b", &is_enabled))
3142 eo_do(obj, eo_event_callback_array_add(_events_cb(), event_infc)); 3490 {
3143 3491 ERR("Could not get 'ScreenReaderEnabled' boolean property");
3144 if (eo_isa(obj, ELM_INTERFACE_ATSPI_COMPONENT_MIXIN)) 3492 return;
3145 eldbus_service_interface_register(_a11y_bus, path, &component_iface_desc);
3146 if (eo_isa(obj, ELM_INTERFACE_ATSPI_WINDOW_INTERFACE))
3147 {
3148 infc = eldbus_service_interface_register(_a11y_bus, path, &window_iface_desc);
3149 eo_do(obj, eo_key_data_set("window_interface", infc));
3150 eo_do(obj, eo_event_callback_array_add(_window_cb(), infc));
3151 }
3152 if (eo_isa(obj, ELM_INTERFACE_ATSPI_ACTION_MIXIN))
3153 eldbus_service_interface_register(_a11y_bus, path, &action_iface_desc);
3154 if (eo_isa(obj, ELM_INTERFACE_ATSPI_VALUE_INTERFACE))
3155 eldbus_service_interface_register(_a11y_bus, path, &value_iface_desc);
3156 if (eo_isa(obj, ELM_INTERFACE_ATSPI_IMAGE_MIXIN))
3157 eldbus_service_interface_register(_a11y_bus, path, &image_iface_desc);
3158 if (eo_isa(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE))
3159 {
3160 eldbus_service_interface_register(_a11y_bus, path, &selection_iface_desc);
3161 eo_do(obj, eo_event_callback_array_add(_selection_cb(), event_infc));
3162 }
3163 if (eo_isa(obj, ELM_INTERFACE_ATSPI_TEXT_INTERFACE))
3164 {
3165 eldbus_service_interface_register(_a11y_bus, path, &text_iface_desc);
3166 eo_do(obj, eo_event_callback_array_add(_text_cb(), event_infc));
3167 }
3168 if (eo_isa(obj, ELM_INTERFACE_ATSPI_EDITABLE_TEXT_INTERFACE))
3169 eldbus_service_interface_register(_a11y_bus, path, &editable_text_iface_desc);
3170 } 3493 }
3494
3495 if (is_enabled)
3496 _a11y_connection_init(data);
3497 else
3498 DBG("AT-SPI2 stack not enabled.");
3171} 3499}
3172 3500
3173static void _object_unregister(void *obj) 3501static void _bridge_object_register(Eo *bridge, Eo *obj)
3174{ 3502{
3175 Eldbus_Service_Interface *infc, *event_infc = NULL; 3503 char *path;
3504 struct cache_closure cc;
3505 Eldbus_Message *sig;
3506 Eldbus_Service_Interface *ifc;
3507
3508 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
3509
3510 if (!eo_isa(obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
3511 {
3512 WRN("Unable to register class w/o Elm_Interface_Atspi_Accessible!");
3513 return;
3514 }
3515
3516 path = _bridge_path_from_object(bridge, obj);
3176 3517
3177 eo_do(obj, event_infc = eo_key_data_get("event_interface")); 3518 if (eina_hash_find(pd->cache, path))
3178 if (_a11y_bus && event_infc)
3179 { 3519 {
3180 eldbus_service_object_unregister(event_infc); 3520 WRN("Object at path: %s already registered", path);
3181 eo_do(obj, eo_key_data_set("event_interface", NULL)); 3521 free(path);
3522 return;
3182 } 3523 }
3183 3524
3184 eo_do(obj, eo_event_callback_del(EO_EV_DEL, _on_cache_item_del, NULL)); 3525 eina_hash_add(pd->cache, path, obj);
3185 3526
3186 if (eo_isa(obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN)) 3527 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &accessible_iface_desc);
3187 eo_do(obj, eo_event_callback_array_del(_events_cb(), event_infc)); 3528 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3529 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN), ifc));
3530
3531 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &event_iface_desc);
3532 eo_do(obj,
3533 eo_event_callback_array_add(_events_cb(), bridge),
3534 eo_key_data_set(ATSPI_DBUS_INTERFACE_EVENT_OBJECT, ifc)
3535 );
3536 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3537
3538 if (eo_isa(obj, ELM_INTERFACE_ATSPI_ACTION_MIXIN))
3539 {
3540 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &action_iface_desc);
3541 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3542 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_ACTION_MIXIN), ifc));
3543 }
3544 if (eo_isa(obj, ELM_INTERFACE_ATSPI_COMPONENT_MIXIN))
3545 {
3546 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &component_iface_desc);
3547 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3548 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_COMPONENT_MIXIN), ifc));
3549 }
3550 if (eo_isa(obj, ELM_INTERFACE_ATSPI_EDITABLE_TEXT_INTERFACE))
3551 {
3552 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &editable_text_iface_desc);
3553 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3554 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_TEXT_INTERFACE), ifc));
3555 }
3556 if (eo_isa(obj, ELM_INTERFACE_ATSPI_IMAGE_MIXIN))
3557 {
3558 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &image_iface_desc);
3559 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3560 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_IMAGE_MIXIN), ifc));
3561 }
3562 if (eo_isa(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE))
3563 {
3564 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &selection_iface_desc);
3565 eo_do(obj, eo_event_callback_array_add(_selection_cb(), bridge));
3566 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3567 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_SELECTION_INTERFACE), ifc));
3568 }
3569 if (eo_isa(obj, ELM_INTERFACE_ATSPI_TEXT_INTERFACE))
3570 {
3571 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &text_iface_desc);
3572 eo_do(obj, eo_event_callback_array_add(_text_cb(), bridge));
3573 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3574 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_TEXT_INTERFACE), ifc));
3575 }
3188 if (eo_isa(obj, ELM_INTERFACE_ATSPI_WINDOW_INTERFACE)) 3576 if (eo_isa(obj, ELM_INTERFACE_ATSPI_WINDOW_INTERFACE))
3189 { 3577 {
3190 eo_do(obj, infc = eo_key_data_get("window_interface")); 3578 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &window_iface_desc);
3191 eo_do(obj, eo_event_callback_array_del(_window_cb(), infc)); 3579 eo_do(obj, eo_event_callback_array_add(_window_cb(), bridge));
3580 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_WINDOW_INTERFACE), ifc));
3581 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3582 }
3583 if (eo_isa(obj, ELM_INTERFACE_ATSPI_VALUE_INTERFACE))
3584 {
3585 ifc = eldbus_service_interface_register(pd->a11y_bus, path, &value_iface_desc);
3586 eldbus_service_object_data_set(ifc, ELM_ATSPI_BRIDGE_CLASS_NAME, bridge);
3587 eo_do(obj, eo_key_data_set(eo_class_name_get(ELM_INTERFACE_ATSPI_VALUE_INTERFACE), ifc));
3192 } 3588 }
3589
3590 sig = eldbus_service_signal_new(pd->cache_interface, ATSPI_OBJECT_CHILD_ADDED);
3591 cc.iter = eldbus_message_iter_get(sig);
3592 cc.bridge = bridge;
3593 _cache_item_reference_append_cb(NULL, NULL, obj, &cc);
3594
3595 eldbus_service_signal_send(pd->cache_interface, sig);
3596
3597 free(path);
3598}
3599
3600static void _object_unregister(Eo *obj, void *data)
3601{
3602 Eldbus_Service_Interface *ifc;
3603
3604 eo_do(obj, eo_event_callback_array_del(_events_cb(), data));
3605 if (eo_isa(obj, ELM_INTERFACE_ATSPI_WINDOW_INTERFACE))
3606 eo_do(obj, eo_event_callback_array_del(_window_cb(), data));
3193 if (eo_isa(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE)) 3607 if (eo_isa(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE))
3194 eo_do(obj, eo_event_callback_array_del(_selection_cb(), event_infc)); 3608 eo_do(obj, eo_event_callback_array_del(_selection_cb(), data));
3195 if (eo_isa(obj, ELM_INTERFACE_ATSPI_TEXT_INTERFACE)) 3609 if (eo_isa(obj, ELM_INTERFACE_ATSPI_TEXT_INTERFACE))
3196 eo_do(obj, eo_event_callback_array_del(_text_cb(), event_infc)); 3610 eo_do(obj, eo_event_callback_array_del(_text_cb(), data));
3611
3612 eo_do(obj, ifc = eo_key_data_get(ATSPI_DBUS_INTERFACE_EVENT_OBJECT));
3613 if (ifc) eldbus_service_interface_unregister(ifc);
3614 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN)));
3615 if (ifc) eldbus_service_interface_unregister(ifc);
3616 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_ACTION_MIXIN)));
3617 if (ifc) eldbus_service_interface_unregister(ifc);
3618 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_COMPONENT_MIXIN)));
3619 if (ifc) eldbus_service_interface_unregister(ifc);
3620 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_EDITABLE_TEXT_INTERFACE)));
3621 if (ifc) eldbus_service_interface_unregister(ifc);
3622 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_IMAGE_MIXIN)));
3623 if (ifc) eldbus_service_interface_unregister(ifc);
3624 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_SELECTION_INTERFACE)));
3625 if (ifc) eldbus_service_interface_unregister(ifc);
3626 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_TEXT_INTERFACE)));
3627 if (ifc) eldbus_service_interface_unregister(ifc);
3628 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_WINDOW_INTERFACE)));
3629 if (ifc) eldbus_service_interface_unregister(ifc);
3630 eo_do(obj, ifc = eo_key_data_get(eo_class_name_get(ELM_INTERFACE_ATSPI_VALUE_INTERFACE)));
3631 if (ifc) eldbus_service_interface_unregister(ifc);
3197} 3632}
3198 3633
3199void 3634void
3200_elm_atspi_bridge_init(void) 3635_elm_atspi_bridge_init(void)
3201{ 3636{
3202 Eldbus_Message *msg;
3203 Eldbus_Connection *session_bus;
3204
3205 if (!_init_count) 3637 if (!_init_count)
3206 { 3638 {
3207 _root = eo_add(ELM_ATSPI_APP_OBJECT_CLASS, NULL); 3639 _instance = eo_add(ELM_ATSPI_BRIDGE_CLASS, NULL);
3208 if (!_root)
3209 {
3210 ERR("Unable to create root object");
3211 return;
3212 }
3213
3214 session_bus = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
3215 EINA_SAFETY_ON_NULL_RETURN(session_bus);
3216 msg = eldbus_message_method_call_new(A11Y_DBUS_NAME, A11Y_DBUS_PATH, A11Y_DBUS_INTERFACE, "GetAddress");
3217 if (!msg)
3218 {
3219 eldbus_connection_unref(session_bus);
3220 return;
3221 }
3222 eldbus_connection_send(session_bus, msg, _a11y_bus_address_get, session_bus, -1);
3223 _cache = eina_hash_string_superfast_new(_object_unregister);
3224 _init_count = 1; 3640 _init_count = 1;
3225 } 3641 }
3226} 3642}
3227 3643
3228EAPI Eo* 3644EAPI Eo*
3229_elm_atspi_bridge_root_get(void) 3645_elm_atspi_bridge_get(void)
3230{ 3646{
3231 return _root; 3647 return _instance;
3232} 3648}
3233 3649
3234void 3650void
@@ -3236,35 +3652,13 @@ _elm_atspi_bridge_shutdown(void)
3236{ 3652{
3237 if (_init_count) 3653 if (_init_count)
3238 { 3654 {
3239 eo_del(_root); 3655 eo_del(_instance);
3240
3241 if (_cache_update_idler)
3242 ecore_idler_del(_cache_update_idler);
3243 _cache_update_idler = NULL;
3244
3245 if (_pending_objects)
3246 eina_list_free(_pending_objects);
3247 _pending_objects = NULL;
3248
3249 if (_cache)
3250 eina_hash_free(_cache);
3251 _cache = NULL;
3252
3253 if (_a11y_bus)
3254 eldbus_connection_unref(_a11y_bus);
3255 _a11y_bus = NULL;
3256
3257 if (_key_flr)
3258 ecore_event_filter_del(_key_flr);
3259 _key_flr = NULL;
3260
3261 _init_count = 0; 3656 _init_count = 0;
3262 _root = NULL;
3263 } 3657 }
3264} 3658}
3265 3659
3266static Key_Event_Info* 3660static Key_Event_Info*
3267_key_event_info_new(int event_type, const Ecore_Event_Key *data) 3661_key_event_info_new(int event_type, const Ecore_Event_Key *data, Eo *bridge)
3268{ 3662{
3269 Key_Event_Info *ret; 3663 Key_Event_Info *ret;
3270 EINA_SAFETY_ON_NULL_RETURN_VAL(data, NULL); 3664 EINA_SAFETY_ON_NULL_RETURN_VAL(data, NULL);
@@ -3273,6 +3667,7 @@ _key_event_info_new(int event_type, const Ecore_Event_Key *data)
3273 3667
3274 ret->type = event_type; 3668 ret->type = event_type;
3275 ret->event = *data; 3669 ret->event = *data;
3670 ret->bridge = bridge;
3276 3671
3277 ret->event.keyname = eina_stringshare_add(data->keyname); 3672 ret->event.keyname = eina_stringshare_add(data->keyname);
3278 ret->event.key = eina_stringshare_add(data->key); 3673 ret->event.key = eina_stringshare_add(data->key);
@@ -3332,6 +3727,8 @@ _on_listener_answer(void *data, const Eldbus_Message *msg, Eldbus_Pending *pendi
3332 const char *errname, *errmsg; 3727 const char *errname, *errmsg;
3333 Eina_Bool ret = EINA_TRUE; 3728 Eina_Bool ret = EINA_TRUE;
3334 3729
3730 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(info->bridge, pd);
3731
3335 if (eldbus_message_error_get(msg, &errname, &errmsg)) 3732 if (eldbus_message_error_get(msg, &errname, &errmsg))
3336 { 3733 {
3337 ERR("%s %s", errname, errmsg); 3734 ERR("%s %s", errname, errmsg);
@@ -3349,28 +3746,30 @@ _on_listener_answer(void *data, const Eldbus_Message *msg, Eldbus_Pending *pendi
3349 } 3746 }
3350reemit: 3747reemit:
3351 ecore_event_add(info->type, &info->event, _on_event_del, info); 3748 ecore_event_add(info->type, &info->event, _on_event_del, info);
3352 reemited_events = eina_list_append(reemited_events, &info->event); 3749 pd->reemited_events = eina_list_append(pd->reemited_events, &info->event);
3353} 3750}
3354 3751
3355static Eina_Bool 3752static Eina_Bool
3356_elm_atspi_bridge_key_filter(void *data EINA_UNUSED, void *loop EINA_UNUSED, int type, void *event) 3753_elm_atspi_bridge_key_filter(void *data, void *loop EINA_UNUSED, int type, void *event)
3357{ 3754{
3358 Eldbus_Message *msg; 3755 Eldbus_Message *msg;
3359 Eldbus_Message_Iter *iter; 3756 Eldbus_Message_Iter *iter;
3360 Ecore_Event_Key *key_event = event; 3757 Ecore_Event_Key *key_event = event;
3361 Key_Event_Info *ke; 3758 Key_Event_Info *ke;
3759 Eo *bridge = data;
3760
3761 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, EINA_TRUE);
3362 3762
3363 if (!_init_count) return EINA_TRUE;
3364 if ((type != ECORE_EVENT_KEY_DOWN) && (type != ECORE_EVENT_KEY_UP)) return EINA_TRUE; 3763 if ((type != ECORE_EVENT_KEY_DOWN) && (type != ECORE_EVENT_KEY_UP)) return EINA_TRUE;
3365 3764
3366 // check if reemited 3765 // check if reemited
3367 if (eina_list_data_find(reemited_events, event)) 3766 if (eina_list_data_find(pd->reemited_events, event))
3368 { 3767 {
3369 reemited_events = eina_list_remove(reemited_events, event); 3768 pd->reemited_events = eina_list_remove(pd->reemited_events, event);
3370 return EINA_TRUE; 3769 return EINA_TRUE;
3371 } 3770 }
3372 3771
3373 ke = _key_event_info_new(type, key_event); 3772 ke = _key_event_info_new(type, key_event, bridge);
3374 if (!ke) return EINA_TRUE; 3773 if (!ke) return EINA_TRUE;
3375 3774
3376 msg = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_DEC, 3775 msg = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, ATSPI_DBUS_PATH_DEC,
@@ -3378,8 +3777,107 @@ _elm_atspi_bridge_key_filter(void *data EINA_UNUSED, void *loop EINA_UNUSED, int
3378 iter = eldbus_message_iter_get(msg); 3777 iter = eldbus_message_iter_get(msg);
3379 _iter_marshall_key_event(iter, ke); 3778 _iter_marshall_key_event(iter, ke);
3380 3779
3381 // timeout should be kept reasonaby low to avoid 3780 // timeout should be kept reasonaby low to avoid delays
3382 eldbus_connection_send(_a11y_bus, msg, _on_listener_answer, ke, 500); 3781 if (!eldbus_connection_send(pd->a11y_bus, msg, _on_listener_answer, ke, 100))
3782 return EINA_TRUE;
3383 3783
3384 return EINA_FALSE; 3784 return EINA_FALSE;
3385} 3785}
3786
3787EOLIAN Eina_Bool
3788_elm_atspi_bridge_connected_get(Eo *obj EINA_UNUSED, Elm_Atspi_Bridge_Data *pd)
3789{
3790 return pd->connected;
3791}
3792
3793EOLIAN Eo*
3794_elm_atspi_bridge_root_get(Eo *obj EINA_UNUSED, Elm_Atspi_Bridge_Data *pd)
3795{
3796 if (!pd->root)
3797 pd->root = eo_add(ELM_ATSPI_APP_OBJECT_CLASS, NULL);
3798
3799 return pd->root;
3800}
3801
3802static void
3803_properties_changed_cb(void *data, Eldbus_Proxy *proxy EINA_UNUSED, void *event)
3804{
3805 Eldbus_Proxy_Event_Property_Changed *ev = event;
3806 Eo *bridge = data;
3807 Eina_Bool val;
3808 const char *ifc = eldbus_proxy_interface_get(ev->proxy);
3809 if (ev->name && !strcmp(ev->name, "ScreenReaderEnabled" ) &&
3810 ifc && !strcmp(A11Y_DBUS_STATUS_INTERFACE, ifc))
3811 {
3812 if (!eina_value_get(ev->value, &val))
3813 {
3814 ERR("Unable to get ScreenReaderEnabled property value");
3815 return;
3816 }
3817 if (val)
3818 _a11y_connection_init(bridge);
3819 else
3820 _a11y_connection_shutdown(bridge);
3821 }
3822}
3823
3824EOLIAN Eo_Base*
3825_elm_atspi_bridge_eo_base_constructor(Eo *obj, Elm_Atspi_Bridge_Data *pd)
3826{
3827 Eldbus_Proxy *proxy;
3828 Eldbus_Pending *req;
3829
3830 eo_do_super(obj, ELM_ATSPI_BRIDGE_CLASS, eo_constructor());
3831
3832 elm_need_eldbus();
3833
3834 if (!(pd->session_bus = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION)))
3835 {
3836 ERR("Unable to connect to Session Bus");
3837 return NULL;
3838 }
3839 if (!(pd->bus_obj = eldbus_object_get(pd->session_bus, A11Y_DBUS_NAME, A11Y_DBUS_PATH)))
3840 {
3841 ERR("Could not get /org/a11y/bus object");
3842 goto obj_err;
3843 }
3844 if (!(proxy = eldbus_proxy_get(pd->bus_obj, A11Y_DBUS_STATUS_INTERFACE)))
3845 {
3846 ERR("Could not get proxy object for %s interface", A11Y_DBUS_STATUS_INTERFACE);
3847 goto proxy_err;
3848 }
3849 if (!(req = eldbus_proxy_property_get(proxy, "ScreenReaderEnabled", _screen_reader_enabled_get, obj)))
3850 {
3851 ERR("Could not send PropertyGet request");
3852 goto proxy_err;
3853 }
3854 pd->pending_requests = eina_list_append(pd->pending_requests, req);
3855
3856 eldbus_proxy_properties_monitor(proxy, EINA_TRUE);
3857 eldbus_proxy_event_callback_add(proxy, ELDBUS_PROXY_EVENT_PROPERTY_CHANGED,
3858 _properties_changed_cb, obj);
3859
3860 return obj;
3861
3862proxy_err:
3863 eldbus_object_unref(pd->bus_obj);
3864 pd->bus_obj = NULL;
3865obj_err:
3866 eldbus_connection_unref(pd->session_bus);
3867 pd->session_bus = NULL;
3868 return NULL;
3869}
3870
3871EOLIAN void
3872_elm_atspi_bridge_eo_base_destructor(Eo *obj, Elm_Atspi_Bridge_Data *pd)
3873{
3874 _a11y_connection_shutdown(obj);
3875
3876 if (pd->bus_obj) eldbus_object_unref(pd->bus_obj);
3877 if (pd->session_bus) eldbus_connection_unref(pd->session_bus);
3878 if (pd->root) eo_del(pd->root);
3879
3880 eo_do_super(obj, ELM_ATSPI_BRIDGE_CLASS, eo_destructor());
3881}
3882
3883#include "elm_atspi_bridge.eo.c"
diff --git a/src/lib/elm_atspi_bridge.eo b/src/lib/elm_atspi_bridge.eo
new file mode 100644
index 000000000..fc1471ac1
--- /dev/null
+++ b/src/lib/elm_atspi_bridge.eo
@@ -0,0 +1,26 @@
1class Elm.Atspi_Bridge (Eo.Base)
2{
3 eo_prefix: elm_obj_atspi_bridge;
4 methods {
5 @property connected {
6 get {
7 /*@ Indicate if connection with AT-SPI2 bus has been established. */
8 values {
9 ret: bool;
10 }
11 }
12 }
13 @property root {
14 get {
15 /*@ Get root object of accessible object hierarchy */
16 values {
17 ret: Eo*;
18 }
19 }
20 }
21 }
22 implements {
23 Eo.Base.constructor;
24 Eo.Base.destructor;
25 }
26}
diff --git a/src/lib/elm_atspi_bridge.h b/src/lib/elm_atspi_bridge.h
new file mode 100644
index 000000000..8827096b6
--- /dev/null
+++ b/src/lib/elm_atspi_bridge.h
@@ -0,0 +1,8 @@
1#ifdef EFL_BETA_API_SUPPORT
2#ifdef EFL_EO_API_SUPPORT
3#include "elm_atspi_bridge.eo.h"
4#endif
5#ifndef EFL_NOLEGACY_API_SUPPORT
6#include "elm_atspi_bridge.eo.legacy.h"
7#endif
8#endif
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 1ed943726..04ba3062c 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -341,7 +341,7 @@ struct _Elm_Module
341 int references; 341 int references;
342}; 342};
343 343
344Eo *_elm_atspi_bridge_root_get(void); 344Eo *_elm_atspi_bridge_get(void);
345void _elm_atspi_bridge_init(void); 345void _elm_atspi_bridge_init(void);
346void _elm_atspi_bridge_shutdown(void); 346void _elm_atspi_bridge_shutdown(void);
347 347
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 47087f66d..ff2021e78 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -3759,7 +3759,9 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
3759 eo_do(obj, elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_WINDOW)); 3759 eo_do(obj, elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_WINDOW));
3760 if (_elm_config->atspi_mode == ELM_ATSPI_MODE_ON) 3760 if (_elm_config->atspi_mode == ELM_ATSPI_MODE_ON)
3761 { 3761 {
3762 elm_interface_atspi_accessible_children_changed_added_signal_emit(_elm_atspi_bridge_root_get(), obj); 3762 Eo *bridge = _elm_atspi_bridge_get();
3763 if (bridge)
3764 elm_interface_atspi_accessible_children_changed_added_signal_emit(elm_atspi_bridge_root_get(bridge), obj);
3763 } 3765 }
3764 3766
3765 evas_object_show(sd->edje); 3767 evas_object_show(sd->edje);
@@ -5419,7 +5421,8 @@ EOLIAN static Eo*
5419_elm_win_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd EINA_UNUSED) 5421_elm_win_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd EINA_UNUSED)
5420{ 5422{
5421 // attach all kinds of windows directly to ATSPI application root object 5423 // attach all kinds of windows directly to ATSPI application root object
5422 return _elm_atspi_bridge_root_get(); 5424 Eo *bridge = _elm_atspi_bridge_get();
5425 return elm_atspi_bridge_root_get(bridge);
5423} 5426}
5424 5427
5425EOLIAN static const Elm_Atspi_Action* 5428EOLIAN static const Elm_Atspi_Action*