summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-06-24 14:34:26 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-06-29 09:15:53 +0200
commit6abe51b13d70769dd13fff7a158242ba99749641 (patch)
treeb81f6834bef341e24ebc20393123229f52ad5679
parentbf1d80c34a574be754ad073a8cd0d17ae7e2c3cf (diff)
atspi: next glboals removed
Change-Id: Ia3ac377795423cbb3868c8aecdd78d8892dfb66c
-rw-r--r--src/lib/elm_atspi_bridge.c170
1 files changed, 100 insertions, 70 deletions
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index 24e676018..ace54aa40 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -36,7 +36,6 @@
36#define ELM_ACCESS_OBJECT_REFERENCE_TEMPLATE ELM_ACCESS_OBJECT_PATH_PREFIX "%llu" 36#define ELM_ACCESS_OBJECT_REFERENCE_TEMPLATE ELM_ACCESS_OBJECT_PATH_PREFIX "%llu"
37 37
38#define SIZE(x) sizeof(x)/sizeof(x[0]) 38#define SIZE(x) sizeof(x)/sizeof(x[0])
39
40#define ELM_ATSPI_BRIDGE_CLASS_NAME "__Elm_Atspi_Bridge" 39#define ELM_ATSPI_BRIDGE_CLASS_NAME "__Elm_Atspi_Bridge"
41 40
42#define ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(obj, sd) \ 41#define ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(obj, sd) \
@@ -102,7 +101,7 @@ static Eina_Bool _text_selection_changed_send(void *data, Eo *obj, const Eo_Even
102// bridge private methods 101// bridge private methods
103static void _bridge_cache_build(Eo *bridge, void *obj); 102static void _bridge_cache_build(Eo *bridge, void *obj);
104static void _bridge_object_register(Eo *bridge, Eo *obj); 103static void _bridge_object_register(Eo *bridge, Eo *obj);
105static void _bridge_object_unregister(Eo *bridge, Eo *obj); 104static void _bridge_object_callbacks_unregister(Eo *bridge, Eo *obj);
106static char * _bridge_path_from_access_object(Eo *bridge, const Eo *eo); 105static char * _bridge_path_from_access_object(Eo *bridge, const Eo *eo);
107static void _bridge_interfaces_register(Eo *bridge); 106static void _bridge_interfaces_register(Eo *bridge);
108static void _bridge_interfaces_unregister(Eo *bridge); 107static void _bridge_interfaces_unregister(Eo *bridge);
@@ -111,7 +110,7 @@ static void _bridge_signal_send(Eo *bridge, Eo *obj, const char *infc, const cha
111// utility functions 110// utility functions
112static void _iter_interfaces_append(Eldbus_Message_Iter *iter, const Eo *obj); 111static void _iter_interfaces_append(Eldbus_Message_Iter *iter, const Eo *obj);
113static Eina_Bool _elm_atspi_bridge_key_filter(void *data, void *loop, int type, void *event); 112static Eina_Bool _elm_atspi_bridge_key_filter(void *data, void *loop, int type, void *event);
114static void _object_unregister(void *obj); 113static void _object_callbacks_unregister(Eo *obj, void *data);
115static Eo * _access_object_from_path(const char *path); 114static Eo * _access_object_from_path(const char *path);
116static void _iter_object_reference_append(Eldbus_Message_Iter *iter, const Eo *obj); 115static void _iter_object_reference_append(Eldbus_Message_Iter *iter, const Eo *obj);
117static void _object_desktop_reference_append(Eldbus_Message_Iter *iter); 116static void _object_desktop_reference_append(Eldbus_Message_Iter *iter);
@@ -119,9 +118,7 @@ static void _object_desktop_reference_append(Eldbus_Message_Iter *iter);
119EO_CALLBACKS_ARRAY_DEFINE(_events_cb, 118EO_CALLBACKS_ARRAY_DEFINE(_events_cb,
120 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_PROPERTY_CHANGED, _property_changed_signal_send}, 119 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_PROPERTY_CHANGED, _property_changed_signal_send},
121 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_CHILDREN_CHANGED, _children_changed_signal_send}, 120 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_CHILDREN_CHANGED, _children_changed_signal_send},
122 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_STATE_CHANGED, _state_changed_signal_send}, 121 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_STATE_CHANGED, _state_changed_signal_send}
123 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_VISIBLE_DATA_CHANGED, NULL },
124 { ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_ACTIVE_DESCENDANTS_CHANGED, NULL }
125); 122);
126 123
127EO_CALLBACKS_ARRAY_DEFINE(_window_cb, 124EO_CALLBACKS_ARRAY_DEFINE(_window_cb,
@@ -142,9 +139,7 @@ EO_CALLBACKS_ARRAY_DEFINE(_text_cb,
142 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, _text_caret_moved_send }, 139 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, _text_caret_moved_send },
143 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_INSERTED, _text_text_inserted_send }, 140 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_INSERTED, _text_text_inserted_send },
144 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_REMOVED, _text_text_removed_send }, 141 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_REMOVED, _text_text_removed_send },
145 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_SELECTION_CHANGED, _text_selection_changed_send }, 142 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_SELECTION_CHANGED, _text_selection_changed_send }
146 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_BOUNDS_CHANGED, NULL },
147 { ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_ATTRIBUTES_CHANGED, NULL }
148); 143);
149 144
150enum _Atspi_Object_Child_Event_Type 145enum _Atspi_Object_Child_Event_Type
@@ -236,28 +231,6 @@ static const Eldbus_Signal _event_obj_signals[] = {
236 {NULL, ELDBUS_ARGS({NULL, NULL}), 0} 231 {NULL, ELDBUS_ARGS({NULL, NULL}), 0}
237}; 232};
238 233
239static const Eldbus_Signal _window_obj_signals[] = {
240 [ATSPI_WINDOW_EVENT_PROPERTY_CHANGE] = {"PropertyChange", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
241 [ATSPI_WINDOW_EVENT_MINIMIZE] = {"Minimize", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
242 [ATSPI_WINDOW_EVENT_MAXIMIZE] = {"Maximize", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
243 [ATSPI_WINDOW_EVENT_RESTORE] = {"Restore", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
244 [ATSPI_WINDOW_EVENT_CLOSE] = {"Close", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
245 [ATSPI_WINDOW_EVENT_CREATE] = {"Create", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
246 [ATSPI_WINDOW_EVENT_REPARENT] = {"Reparent", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
247 [ATSPI_WINDOW_EVENT_DESKTOPCREATE] = {"DesktopCreate", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
248 [ATSPI_WINDOW_EVENT_DESKTOPDESTROY] = {"DesktopDestroy", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
249 [ATSPI_WINDOW_EVENT_DESTROY] = {"Destroy", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
250 [ATSPI_WINDOW_EVENT_ACTIVATE] = {"Activate", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
251 [ATSPI_WINDOW_EVENT_DEACTIVATE] = {"Deactivate", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
252 [ATSPI_WINDOW_EVENT_RAISE] = {"Raise", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
253 [ATSPI_WINDOW_EVENT_LOWER] = {"Lower", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
254 [ATSPI_WINDOW_EVENT_MOVE] = {"Move", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
255 [ATSPI_WINDOW_EVENT_RESIZE] = {"Resize", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
256 [ATSPI_WINDOW_EVENT_SHADE] = {"Shade", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
257 [ATSPI_WINDOW_EVENT_UUSHADE] = {"uUshade", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
258 [ATSPI_WINDOW_EVENT_RESTYLE] = {"Restyle", ELDBUS_ARGS({"siiv(so)", NULL}), 0},
259 {NULL, ELDBUS_ARGS({NULL, NULL}), 0}
260};
261#endif 234#endif
262 235
263const int elm_roles_to_atspi_roles[][2] = { 236const int elm_roles_to_atspi_roles[][2] = {
@@ -436,6 +409,11 @@ const int elm_relation_to_atspi_relation_mapping[] = {
436 [ELM_ATSPI_RELATION_LAST_DEFINED] = ATSPI_RELATION_LAST_DEFINED, 409 [ELM_ATSPI_RELATION_LAST_DEFINED] = ATSPI_RELATION_LAST_DEFINED,
437}; 410};
438 411
412static inline Eldbus_Message *_dbus_invalid_ref_error_new(const Eldbus_Message *msg)
413{
414 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
415}
416
439static AtspiRelationType _elm_relation_to_atspi_relation(Elm_Atspi_Relation_Type type) 417static AtspiRelationType _elm_relation_to_atspi_relation(Elm_Atspi_Relation_Type type)
440{ 418{
441 if ((type < ELM_ATSPI_RELATION_LAST_DEFINED) && (type > ELM_ATSPI_RELATION_NULL)) 419 if ((type < ELM_ATSPI_RELATION_LAST_DEFINED) && (type > ELM_ATSPI_RELATION_NULL))
@@ -451,6 +429,9 @@ _accessible_get_role(const Eldbus_Service_Interface *iface, const Eldbus_Message
451 AtspiRole atspi_role = ATSPI_ROLE_INVALID; 429 AtspiRole atspi_role = ATSPI_ROLE_INVALID;
452 Elm_Atspi_Role role; 430 Elm_Atspi_Role role;
453 431
432 if (!obj)
433 return _dbus_invalid_ref_error_new(msg);
434
454 eo_do(obj, role = elm_interface_atspi_accessible_role_get()); 435 eo_do(obj, role = elm_interface_atspi_accessible_role_get());
455 436
456 Eldbus_Message *ret = eldbus_message_method_return_new(msg); 437 Eldbus_Message *ret = eldbus_message_method_return_new(msg);
@@ -467,6 +448,9 @@ _accessible_get_role_name(const Eldbus_Service_Interface *iface, const Eldbus_Me
467 const char *role_name = NULL, *obj_path = eldbus_service_object_path_get(iface); 448 const char *role_name = NULL, *obj_path = eldbus_service_object_path_get(iface);
468 Eo *obj = _access_object_from_path(obj_path); 449 Eo *obj = _access_object_from_path(obj_path);
469 450
451 if (!obj)
452 return _dbus_invalid_ref_error_new(msg);
453
470 eo_do(obj, role_name = elm_interface_atspi_accessible_role_name_get()); 454 eo_do(obj, role_name = elm_interface_atspi_accessible_role_name_get());
471 455
472 Eldbus_Message *ret = eldbus_message_method_return_new(msg); 456 Eldbus_Message *ret = eldbus_message_method_return_new(msg);
@@ -482,6 +466,9 @@ _accessible_get_localized_role_name(const Eldbus_Service_Interface *iface, const
482 const char *l_role_name = NULL, *obj_path = eldbus_service_object_path_get(iface); 466 const char *l_role_name = NULL, *obj_path = eldbus_service_object_path_get(iface);
483 Eo *obj = _access_object_from_path(obj_path); 467 Eo *obj = _access_object_from_path(obj_path);
484 468
469 if (!obj)
470 return _dbus_invalid_ref_error_new(msg);
471
485 eo_do(obj, l_role_name = elm_interface_atspi_accessible_localized_role_name_get()); 472 eo_do(obj, l_role_name = elm_interface_atspi_accessible_localized_role_name_get());
486 EINA_SAFETY_ON_NULL_RETURN_VAL(l_role_name, NULL); 473 EINA_SAFETY_ON_NULL_RETURN_VAL(l_role_name, NULL);
487 474
@@ -499,10 +486,12 @@ _accessible_get_children(const Eldbus_Service_Interface *iface, const Eldbus_Mes
499 Eo *obj = _access_object_from_path(obj_path); 486 Eo *obj = _access_object_from_path(obj_path);
500 Eina_List *children_list = NULL, *l; 487 Eina_List *children_list = NULL, *l;
501 Eldbus_Message *ret; 488 Eldbus_Message *ret;
502
503 Eldbus_Message_Iter *iter, *iter_array; 489 Eldbus_Message_Iter *iter, *iter_array;
504 Eo *children; 490 Eo *children;
505 491
492 if (!obj)
493 return _dbus_invalid_ref_error_new(msg);
494
506 eo_do(obj, children_list = elm_interface_atspi_accessible_children_get()); 495 eo_do(obj, children_list = elm_interface_atspi_accessible_children_get());
507 496
508 ret = eldbus_message_method_return_new(msg); 497 ret = eldbus_message_method_return_new(msg);
@@ -542,13 +531,17 @@ _accessible_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_M
542 Eina_List *attrs, *l; 531 Eina_List *attrs, *l;
543 Elm_Atspi_Attribute *attr; 532 Elm_Atspi_Attribute *attr;
544 Eldbus_Message_Iter *iter, *iter_dict, *iter_entry; 533 Eldbus_Message_Iter *iter, *iter_dict, *iter_entry;
545 534 Eldbus_Message *ret;
546 Eldbus_Message *ret = eldbus_message_method_return_new(msg);
547 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
548 535
549 const char *obj_path = eldbus_service_object_path_get(iface); 536 const char *obj_path = eldbus_service_object_path_get(iface);
550 Eo *obj = _access_object_from_path(obj_path); 537 Eo *obj = _access_object_from_path(obj_path);
551 538
539 if (!obj)
540 return _dbus_invalid_ref_error_new(msg);
541
542 ret = eldbus_message_method_return_new(msg);
543 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
544
552 eo_do(obj, attrs = elm_interface_atspi_accessible_attributes_get()); 545 eo_do(obj, attrs = elm_interface_atspi_accessible_attributes_get());
553 546
554 iter = eldbus_message_iter_get(ret); 547 iter = eldbus_message_iter_get(ret);
@@ -577,6 +570,9 @@ _accessible_interfaces_get(const Eldbus_Service_Interface *iface, const Eldbus_M
577 const char *obj_path = eldbus_service_object_path_get(iface); 570 const char *obj_path = eldbus_service_object_path_get(iface);
578 Eo *obj = _access_object_from_path(obj_path); 571 Eo *obj = _access_object_from_path(obj_path);
579 572
573 if (!obj)
574 return _dbus_invalid_ref_error_new(msg);
575
580 ret = eldbus_message_method_return_new(msg); 576 ret = eldbus_message_method_return_new(msg);
581 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 577 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
582 578
@@ -1132,6 +1128,9 @@ _text_string_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbus_M
1132 Eldbus_Message *ret; 1128 Eldbus_Message *ret;
1133 Eo *obj = _access_object_from_path(obj_path); 1129 Eo *obj = _access_object_from_path(obj_path);
1134 1130
1131 if (!obj)
1132 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1133
1135 if (!eldbus_message_arguments_get(msg, "iu", &start, &gran)) 1134 if (!eldbus_message_arguments_get(msg, "iu", &start, &gran))
1136 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected."); 1135 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected.");
1137 1136
@@ -1155,6 +1154,9 @@ _text_text_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
1155 Eo *obj = _access_object_from_path(obj_path); 1154 Eo *obj = _access_object_from_path(obj_path);
1156 int start, end; 1155 int start, end;
1157 1156
1157 if (!obj)
1158 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1159
1158 if (!eldbus_message_arguments_get(msg, "ii", &start, &end)) 1160 if (!eldbus_message_arguments_get(msg, "ii", &start, &end))
1159 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected."); 1161 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and granularity expected.");
1160 1162
@@ -1179,6 +1181,9 @@ _text_caret_offset_set(const Eldbus_Service_Interface *iface, const Eldbus_Messa
1179 Eldbus_Message *ret; 1181 Eldbus_Message *ret;
1180 Eina_Bool res; 1182 Eina_Bool res;
1181 1183
1184 if (!obj)
1185 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1186
1182 if (!eldbus_message_arguments_get(msg, "i", &offset)) 1187 if (!eldbus_message_arguments_get(msg, "i", &offset))
1183 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1188 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
1184 1189
@@ -1201,6 +1206,9 @@ _text_character_at_offset_get(const Eldbus_Service_Interface *iface, const Eldbu
1201 Eldbus_Message *ret; 1206 Eldbus_Message *ret;
1202 Eina_Unicode res; 1207 Eina_Unicode res;
1203 1208
1209 if (!obj)
1210 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1211
1204 if (!eldbus_message_arguments_get(msg, "i", &offset)) 1212 if (!eldbus_message_arguments_get(msg, "i", &offset))
1205 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1213 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
1206 1214
@@ -1224,6 +1232,9 @@ _text_attribute_value_get(const Eldbus_Service_Interface *iface, const Eldbus_Me
1224 Eldbus_Message *ret; 1232 Eldbus_Message *ret;
1225 Eina_Bool res; 1233 Eina_Bool res;
1226 1234
1235 if (!obj)
1236 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1237
1227 if (!eldbus_message_arguments_get(msg, "is", &start, &name)) 1238 if (!eldbus_message_arguments_get(msg, "is", &start, &name))
1228 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and attribute name expected."); 1239 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and attribute name expected.");
1229 1240
@@ -1248,6 +1259,9 @@ _text_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message
1248 Eina_List *attrs; 1259 Eina_List *attrs;
1249 Elm_Atspi_Text_Attribute *attr; 1260 Elm_Atspi_Text_Attribute *attr;
1250 1261
1262 if (!obj)
1263 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1264
1251 if (!eldbus_message_arguments_get(msg, "i", &start)) 1265 if (!eldbus_message_arguments_get(msg, "i", &start))
1252 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected."); 1266 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset expected.");
1253 1267
@@ -1287,6 +1301,9 @@ _text_default_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus
1287 Eina_List *attrs; 1301 Eina_List *attrs;
1288 Elm_Atspi_Text_Attribute *attr; 1302 Elm_Atspi_Text_Attribute *attr;
1289 1303
1304 if (!obj)
1305 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1306
1290 ret = eldbus_message_method_return_new(msg); 1307 ret = eldbus_message_method_return_new(msg);
1291 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1308 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1292 1309
@@ -1323,6 +1340,9 @@ _text_character_extents_get(const Eldbus_Service_Interface *iface, const Eldbus_
1323 Eina_Bool screen_coords, res; 1340 Eina_Bool screen_coords, res;
1324 Eldbus_Message *ret; 1341 Eldbus_Message *ret;
1325 1342
1343 if (!obj)
1344 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1345
1326 if (!eldbus_message_arguments_get(msg, "iu", &offset, &type)) 1346 if (!eldbus_message_arguments_get(msg, "iu", &offset, &type))
1327 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected."); 1347 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected.");
1328 1348
@@ -1353,6 +1373,9 @@ _text_offset_at_point_get(const Eldbus_Service_Interface *iface, const Eldbus_Me
1353 Eina_Bool screen_coords; 1373 Eina_Bool screen_coords;
1354 Eldbus_Message *ret; 1374 Eldbus_Message *ret;
1355 1375
1376 if (!obj)
1377 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1378
1356 if (!eldbus_message_arguments_get(msg, "iiu", &x, &y, &type)) 1379 if (!eldbus_message_arguments_get(msg, "iiu", &x, &y, &type))
1357 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected."); 1380 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Offset and coordinates type expected.");
1358 1381
@@ -1377,6 +1400,9 @@ _text_n_selections_get(const Eldbus_Service_Interface *iface, const Eldbus_Messa
1377 int n; 1400 int n;
1378 Eldbus_Message *ret; 1401 Eldbus_Message *ret;
1379 1402
1403 if (!obj)
1404 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1405
1380 ret = eldbus_message_method_return_new(msg); 1406 ret = eldbus_message_method_return_new(msg);
1381 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 1407 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
1382 1408
@@ -1395,6 +1421,9 @@ _text_selection_get(const Eldbus_Service_Interface *iface, const Eldbus_Message
1395 int sel_num, start, end; 1421 int sel_num, start, end;
1396 Eldbus_Message *ret; 1422 Eldbus_Message *ret;
1397 1423
1424 if (!obj)
1425 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1426
1398 if (!eldbus_message_arguments_get(msg, "i", &sel_num)) 1427 if (!eldbus_message_arguments_get(msg, "i", &sel_num))
1399 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected."); 1428 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Selection number expected.");
1400 1429
@@ -1417,6 +1446,9 @@ _text_selection_add(const Eldbus_Service_Interface *iface, const Eldbus_Message
1417 Eina_Bool res; 1446 Eina_Bool res;
1418 Eldbus_Message *ret; 1447 Eldbus_Message *ret;
1419 1448
1449 if (!obj)
1450 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.UnknownObject", "Path is not valid accessible object reference.");
1451
1420 if (!eldbus_message_arguments_get(msg, "ii", &start, &end)) 1452 if (!eldbus_message_arguments_get(msg, "ii", &start, &end))
1421 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end text offset expected."); 1453 return eldbus_message_error_new(msg, "org.freedesktop.DBus.Error.InvalidArgs", "Start and end text offset expected.");
1422 1454
@@ -2588,21 +2620,19 @@ _elm_atspi_bridge_app_register(Eo *bridge)
2588 "Embed"); 2620 "Embed");
2589 Eldbus_Message_Iter *iter = eldbus_message_iter_get(message); 2621 Eldbus_Message_Iter *iter = eldbus_message_iter_get(message);
2590 2622
2591 _iter_object_reference_append(iter, elm_atspi_bridge_root_get(_instance)); 2623 _iter_object_reference_append(iter, elm_atspi_bridge_root_get(bridge));
2592 eldbus_connection_send(pd->a11y_bus, message, _on_elm_atspi_bridge_app_register, NULL, -1); 2624 eldbus_connection_send(pd->a11y_bus, message, _on_elm_atspi_bridge_app_register, NULL, -1);
2593 2625
2594 return EINA_TRUE; 2626 return EINA_TRUE;
2595} 2627}
2596 2628
2597EAPI Eina_Bool 2629EAPI Eina_Bool
2598_elm_atspi_bridge_app_unregister(void) 2630_elm_atspi_bridge_app_unregister(Eo *bridge)
2599{ 2631{
2600 Eo *root; 2632 Eo *root;
2633 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(bridge, pd, EINA_FALSE);
2601 2634
2602 if (!_instance) return EINA_FALSE; 2635 root = elm_atspi_bridge_root_get(bridge);
2603 root = elm_atspi_bridge_root_get(_instance);
2604 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(_instance, ELM_ATSPI_BRIDGE_CLASS);
2605 if (!pd) return EINA_FALSE;
2606 2636
2607 Eldbus_Message *message = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY, 2637 Eldbus_Message *message = eldbus_message_method_call_new(ATSPI_DBUS_NAME_REGISTRY,
2608 ATSPI_DBUS_PATH_ROOT, 2638 ATSPI_DBUS_PATH_ROOT,
@@ -2762,10 +2792,7 @@ _state_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descr
2762 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE); 2792 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_FALSE);
2763 2793
2764 if (!STATE_TYPE_GET(pd->object_state_broadcast_mask, state_data->type)) 2794 if (!STATE_TYPE_GET(pd->object_state_broadcast_mask, state_data->type))
2765 { 2795 return EINA_FALSE;
2766 DBG("Masking event: %d", state_data->type);
2767 return EINA_FALSE;
2768 }
2769 2796
2770 switch (state_data->type) { 2797 switch (state_data->type) {
2771 case ELM_ATSPI_STATE_FOCUSED: 2798 case ELM_ATSPI_STATE_FOCUSED:
@@ -2789,8 +2816,6 @@ _state_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descr
2789 _bridge_signal_send(data, obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, "StateChanged", 2816 _bridge_signal_send(data, obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, "StateChanged",
2790 type_desc, state_data->new_value, 0, NULL); 2817 type_desc, state_data->new_value, 0, NULL);
2791 2818
2792 DBG("signal sent StateChanged:%s:%d", type_desc, state_data->new_value);
2793
2794 return EINA_TRUE; 2819 return EINA_TRUE;
2795} 2820}
2796 2821
@@ -2842,8 +2867,6 @@ _property_changed_signal_send(void *data, Eo *obj EINA_UNUSED, const Eo_Event_De
2842 _bridge_signal_send(data, obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, "PropertyChange", 2867 _bridge_signal_send(data, obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, "PropertyChange",
2843 atspi_desc, 0, 0, NULL, NULL); 2868 atspi_desc, 0, 0, NULL, NULL);
2844 2869
2845 DBG("signal sent PropertyChange:%s", property);
2846
2847 return EINA_TRUE; 2870 return EINA_TRUE;
2848} 2871}
2849 2872
@@ -2884,9 +2907,7 @@ _children_changed_signal_send(void *data, Eo *obj, const Eo_Event_Description *d
2884 atspi_desc, idx, 0, "(so)", eldbus_connection_unique_name_get(pd->a11y_bus), ev_data->child); 2907 atspi_desc, idx, 0, "(so)", eldbus_connection_unique_name_get(pd->a11y_bus), ev_data->child);
2885 2908
2886 if (type == ATSPI_OBJECT_CHILD_REMOVED) 2909 if (type == ATSPI_OBJECT_CHILD_REMOVED)
2887 _bridge_object_unregister(data, ev_data->child); 2910 _bridge_object_callbacks_unregister(data, ev_data->child);
2888
2889 DBG("signal sent ChildrenChanged:%s:%d", atspi_desc, idx);
2890 2911
2891 return EINA_TRUE; 2912 return EINA_TRUE;
2892} 2913}
@@ -2948,8 +2969,6 @@ _window_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc, void
2948 2969
2949 _bridge_signal_send(data, obj, ATSPI_DBUS_INTERFACE_EVENT_WINDOW, name, "", 0, 0, "i", 0); 2970 _bridge_signal_send(data, obj, ATSPI_DBUS_INTERFACE_EVENT_WINDOW, name, "", 0, 0, "i", 0);
2950 2971
2951 DBG("sent signal org.a11y.atspi.Window:%d", type);
2952
2953 return EINA_TRUE; 2972 return EINA_TRUE;
2954} 2973}
2955 2974
@@ -2963,8 +2982,6 @@ _selection_signal_send(void *data, Eo *obj, const Eo_Event_Description *desc EIN
2963 2982
2964 _bridge_signal_send(data, obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, "SelectionChanged", "", 0, 0, "i", 0); 2983 _bridge_signal_send(data, obj, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, "SelectionChanged", "", 0, 0, "i", 0);
2965 2984
2966 DBG("sent signal org.a11y.atspi.Event:SelectionChanged");
2967
2968 return EINA_TRUE; 2985 return EINA_TRUE;
2969} 2986}
2970 2987
@@ -3047,6 +3064,8 @@ static void _bridge_signal_send(Eo *bridge, Eo *obj, const char *infc, const cha
3047 free(path); 3064 free(path);
3048 3065
3049 eldbus_connection_send(pd->a11y_bus, msg, NULL, NULL, -1); 3066 eldbus_connection_send(pd->a11y_bus, msg, NULL, NULL, -1);
3067
3068 DBG("Signal send:%s:%s:%s:(%d,%d)", infc, signal, minor, det1, det2);
3050} 3069}
3051 3070
3052static Eina_Bool 3071static Eina_Bool
@@ -3126,13 +3145,15 @@ _event_handlers_register(Eo *bridge)
3126} 3145}
3127 3146
3128static void 3147static void
3129_bridge_object_unregister(Eo *bridge, Eo *obj) 3148_bridge_object_callbacks_unregister(Eo *bridge, Eo *obj)
3130{ 3149{
3131 char *path; 3150 char *path;
3132 Eldbus_Message *sig; 3151 Eldbus_Message *sig;
3133 3152
3134 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd); 3153 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
3135 3154
3155 _object_callbacks_unregister(obj, bridge);
3156
3136 sig = eldbus_service_signal_new(pd->cache_interface, ATSPI_OBJECT_CHILD_REMOVED); 3157 sig = eldbus_service_signal_new(pd->cache_interface, ATSPI_OBJECT_CHILD_REMOVED);
3137 Eldbus_Message_Iter *iter = eldbus_message_iter_get(sig); 3158 Eldbus_Message_Iter *iter = eldbus_message_iter_get(sig);
3138 3159
@@ -3146,11 +3167,11 @@ _bridge_object_unregister(Eo *bridge, Eo *obj)
3146} 3167}
3147 3168
3148static Eina_Bool 3169static Eina_Bool
3149_on_cache_item_del(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED) 3170_on_object_del(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED)
3150{ 3171{
3151 Eo *bridge = data; 3172 Eo *bridge = data;
3152 3173
3153 _bridge_object_unregister(bridge, obj); 3174 _bridge_object_callbacks_unregister(bridge, obj);
3154 3175
3155 return EINA_TRUE; 3176 return EINA_TRUE;
3156} 3177}
@@ -3173,15 +3194,26 @@ _bridge_cache_build(Eo *bridge, void *obj)
3173 _bridge_cache_build(bridge, child); 3194 _bridge_cache_build(bridge, child);
3174} 3195}
3175 3196
3197static Eina_Bool _unregister_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
3198{
3199 _object_callbacks_unregister(data, fdata);
3200 return EINA_TRUE;
3201}
3202
3176static void 3203static void
3177_a11y_connection_shutdown(Eo *bridge) 3204_a11y_connection_shutdown(Eo *bridge)
3178{ 3205{
3179 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(bridge, ELM_ATSPI_BRIDGE_CLASS); 3206 Elm_Atspi_Bridge_Data *pd = eo_data_scope_get(bridge, ELM_ATSPI_BRIDGE_CLASS);
3180 Eldbus_Pending *pending; 3207 Eldbus_Pending *pending;
3181 3208
3209 _elm_atspi_bridge_app_unregister(bridge);
3182 _bridge_interfaces_unregister(bridge); 3210 _bridge_interfaces_unregister(bridge);
3183 3211
3184 if (pd->cache) eina_hash_free(pd->cache); 3212 if (pd->cache)
3213 {
3214 eina_hash_foreach(pd->cache, _unregister_cb, bridge);
3215 eina_hash_free(pd->cache);
3216 }
3185 pd->cache = NULL; 3217 pd->cache = NULL;
3186 3218
3187 if (pd->cache_interface) 3219 if (pd->cache_interface)
@@ -3278,7 +3310,7 @@ _a11y_bus_initialize(Eo *obj, const char *socket_addr)
3278 eldbus_connection_event_callback_add(pd->a11y_bus, ELDBUS_CONNECTION_EVENT_DISCONNECTED, _disconnect_cb, obj); 3310 eldbus_connection_event_callback_add(pd->a11y_bus, ELDBUS_CONNECTION_EVENT_DISCONNECTED, _disconnect_cb, obj);
3279 3311
3280 // init data structures 3312 // init data structures
3281 pd->cache = eina_hash_string_superfast_new(_object_unregister); 3313 pd->cache = eina_hash_string_superfast_new(NULL);
3282 3314
3283 // register interfaces 3315 // register interfaces
3284 _cache_register(obj); 3316 _cache_register(obj);
@@ -3390,7 +3422,7 @@ static void _bridge_object_register(Eo *bridge, Eo *obj)
3390 eina_hash_add(pd->cache, path, obj); 3422 eina_hash_add(pd->cache, path, obj);
3391 3423
3392 eo_do(obj, 3424 eo_do(obj,
3393 eo_event_callback_add(EO_EV_DEL, _on_cache_item_del, bridge), 3425 eo_event_callback_add(EO_EV_DEL, _on_object_del, bridge),
3394 eo_event_callback_array_add(_events_cb(), bridge) 3426 eo_event_callback_array_add(_events_cb(), bridge)
3395 ); 3427 );
3396 3428
@@ -3410,20 +3442,18 @@ static void _bridge_object_register(Eo *bridge, Eo *obj)
3410 free(path); 3442 free(path);
3411} 3443}
3412 3444
3413static void _object_unregister(void *obj) 3445static void _object_callbacks_unregister(Eo *obj, void *data)
3414{ 3446{
3415 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(_instance, pd);
3416
3417 eo_do(obj, 3447 eo_do(obj,
3418 eo_event_callback_del(EO_EV_DEL, _on_cache_item_del, _instance), 3448 eo_event_callback_del(EO_EV_DEL, _on_object_del, data),
3419 eo_event_callback_array_del(_events_cb(), _instance) 3449 eo_event_callback_array_del(_events_cb(), data)
3420 ); 3450 );
3421 if (eo_isa(obj, ELM_INTERFACE_ATSPI_WINDOW_INTERFACE)) 3451 if (eo_isa(obj, ELM_INTERFACE_ATSPI_WINDOW_INTERFACE))
3422 eo_do(obj, eo_event_callback_array_del(_window_cb(), _instance)); 3452 eo_do(obj, eo_event_callback_array_del(_window_cb(), data));
3423 if (eo_isa(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE)) 3453 if (eo_isa(obj, ELM_INTERFACE_ATSPI_SELECTION_INTERFACE))
3424 eo_do(obj, eo_event_callback_array_del(_selection_cb(), _instance)); 3454 eo_do(obj, eo_event_callback_array_del(_selection_cb(), data));
3425 if (eo_isa(obj, ELM_INTERFACE_ATSPI_TEXT_INTERFACE)) 3455 if (eo_isa(obj, ELM_INTERFACE_ATSPI_TEXT_INTERFACE))
3426 eo_do(obj, eo_event_callback_array_del(_text_cb(), _instance)); 3456 eo_do(obj, eo_event_callback_array_del(_text_cb(), data));
3427} 3457}
3428 3458
3429static Eina_Bool 3459static Eina_Bool