summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-10-09 16:17:52 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-11-12 10:15:03 +0100
commit93e3ced154ba22bcb28ede0183c5ef418efd78fb (patch)
tree45e9f7be31612d3a773c779ba0984f5f1d966f3e
parent7fd98c9fe67db0f0355a82362dc70f71e6e4dcdf (diff)
atspi: always update cache
libatspi implementation allows to call methods on objects which are not added to client cache with "AddAccessible" at-spi signal. Bridge should allow to perform such calls by updating its internal cache as soons as it returns a reference to the dbus object to client.
-rw-r--r--src/lib/elm_atspi_bridge.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index f67c5c181..c75560103 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -556,7 +556,10 @@ _accessible_get_children(const Eldbus_Service_Interface *iface, const Eldbus_Mes
556 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail); 556 EINA_SAFETY_ON_NULL_GOTO(iter_array, fail);
557 557
558 EINA_LIST_FOREACH(children_list, l, children) 558 EINA_LIST_FOREACH(children_list, l, children)
559 _bridge_iter_object_reference_append(bridge, iter_array, children); 559 {
560 _bridge_iter_object_reference_append(bridge, iter_array, children);
561 _bridge_object_register(bridge, children);
562 }
560 563
561 eldbus_message_iter_container_close(iter, iter_array); 564 eldbus_message_iter_container_close(iter, iter_array);
562 eina_list_free(children_list); 565 eina_list_free(children_list);
@@ -776,6 +779,7 @@ _accessible_child_at_index(const Eldbus_Service_Interface *iface EINA_UNUSED, co
776 779
777 child = eina_list_nth(children, idx); 780 child = eina_list_nth(children, idx);
778 _bridge_iter_object_reference_append(bridge, iter, child); 781 _bridge_iter_object_reference_append(bridge, iter, child);
782 _bridge_object_register(bridge, child);
779 eina_list_free(children); 783 eina_list_free(children);
780 784
781 return ret; 785 return ret;
@@ -811,7 +815,10 @@ _accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED,
811 iter_array2 = eldbus_message_iter_container_new(iter_struct, 'a', "(so)"); 815 iter_array2 = eldbus_message_iter_container_new(iter_struct, 'a', "(so)");
812 EINA_SAFETY_ON_NULL_GOTO(iter_array2, fail); 816 EINA_SAFETY_ON_NULL_GOTO(iter_array2, fail);
813 EINA_LIST_FOREACH(rel->objects, l2, rel_obj) 817 EINA_LIST_FOREACH(rel->objects, l2, rel_obj)
814 _bridge_iter_object_reference_append(bridge, iter_array2, rel_obj); 818 {
819 _bridge_iter_object_reference_append(bridge, iter_array2, rel_obj);
820 _bridge_object_register(bridge, rel_obj);
821 }
815 eldbus_message_iter_container_close(iter_struct, iter_array2); 822 eldbus_message_iter_container_close(iter_struct, iter_array2);
816 eldbus_message_iter_container_close(iter_array, iter_struct); 823 eldbus_message_iter_container_close(iter_array, iter_struct);
817 } 824 }
@@ -863,6 +870,7 @@ _selection_selected_child_get(const Eldbus_Service_Interface *iface EINA_UNUSED,
863 eo_do(obj, child = elm_interface_atspi_selection_selected_child_get(idx)); 870 eo_do(obj, child = elm_interface_atspi_selection_selected_child_get(idx));
864 871
865 _bridge_iter_object_reference_append(bridge, iter, child); 872 _bridge_iter_object_reference_append(bridge, iter, child);
873 _bridge_object_register(bridge, child);
866 874
867 return ret; 875 return ret;
868} 876}
@@ -3311,6 +3319,7 @@ _component_get_accessible_at_point(const Eldbus_Service_Interface *iface EINA_UN
3311 Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE; 3319 Eina_Bool type = coord_type == ATSPI_COORD_TYPE_SCREEN ? EINA_TRUE : EINA_FALSE;
3312 eo_do(obj, accessible = elm_interface_atspi_component_accessible_at_point_get(type, x, y)); 3320 eo_do(obj, accessible = elm_interface_atspi_component_accessible_at_point_get(type, x, y));
3313 _bridge_iter_object_reference_append(bridge, iter, accessible); 3321 _bridge_iter_object_reference_append(bridge, iter, accessible);
3322 _bridge_object_register(bridge, accessible);
3314 3323
3315 return ret; 3324 return ret;
3316} 3325}
@@ -4133,23 +4142,24 @@ _event_handlers_register(Eo *bridge)
4133static void 4142static void
4134_bridge_object_unregister(Eo *bridge, Eo *obj) 4143_bridge_object_unregister(Eo *bridge, Eo *obj)
4135{ 4144{
4136 Eldbus_Message *sig;
4137
4138 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd); 4145 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
4139 4146
4140 sig = eldbus_service_signal_new(pd->cache_interface, ATSPI_OBJECT_CHILD_REMOVED);
4141 Eldbus_Message_Iter *iter = eldbus_message_iter_get(sig);
4142 _bridge_iter_object_reference_append(bridge, iter, obj);
4143 eldbus_service_signal_send(pd->cache_interface, sig);
4144
4145 eina_hash_del(pd->cache, &obj, obj); 4147 eina_hash_del(pd->cache, &obj, obj);
4146} 4148}
4147 4149
4148static Eina_Bool 4150static Eina_Bool
4149_on_object_add(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED) 4151_on_object_add(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED)
4150{ 4152{
4151 Eo *bridge = data; 4153 Eldbus_Message *sig;
4152 _bridge_object_register(bridge, obj); 4154 Eldbus_Message_Iter *iter;
4155
4156 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_TRUE);
4157
4158 sig = eldbus_service_signal_new(pd->cache_interface, ATSPI_OBJECT_CHILD_ADDED);
4159 iter = eldbus_message_iter_get(sig);
4160 _cache_item_reference_append_cb(data, obj, iter);
4161
4162 eldbus_service_signal_send(pd->cache_interface, sig);
4153 4163
4154 return EINA_TRUE; 4164 return EINA_TRUE;
4155} 4165}
@@ -4157,8 +4167,16 @@ _on_object_add(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSE
4157static Eina_Bool 4167static Eina_Bool
4158_on_object_del(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED) 4168_on_object_del(void *data, Eo *obj, const Eo_Event_Description *event EINA_UNUSED, void *event_info EINA_UNUSED)
4159{ 4169{
4160 Eo *bridge = data; 4170 Eldbus_Message *sig;
4161 _bridge_object_unregister(bridge, obj); 4171
4172 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_TRUE);
4173
4174 _bridge_object_unregister(data, obj);
4175
4176 sig = eldbus_service_signal_new(pd->cache_interface, ATSPI_OBJECT_CHILD_REMOVED);
4177 Eldbus_Message_Iter *iter = eldbus_message_iter_get(sig);
4178 _bridge_iter_object_reference_append(data, iter, obj);
4179 eldbus_service_signal_send(pd->cache_interface, sig);
4162 4180
4163 return EINA_TRUE; 4181 return EINA_TRUE;
4164} 4182}
@@ -4289,6 +4307,8 @@ _bridge_accessible_event_dispatch(void *data, Eo *accessible, const Eo_Event_Des
4289{ 4307{
4290 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_TRUE); 4308 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN_VAL(data, pd, EINA_TRUE);
4291 4309
4310 _bridge_object_register(data, accessible);
4311
4292 Eo_Event_Cb cb = eina_hash_find(pd->event_hash, &desc); 4312 Eo_Event_Cb cb = eina_hash_find(pd->event_hash, &desc);
4293 return cb ? cb(data, accessible, desc, event_info) : EINA_TRUE; 4313 return cb ? cb(data, accessible, desc, event_info) : EINA_TRUE;
4294} 4314}
@@ -4392,9 +4412,6 @@ _screen_reader_enabled_get(void *data, const Eldbus_Message *msg, Eldbus_Pending
4392 4412
4393static void _bridge_object_register(Eo *bridge, Eo *obj) 4413static void _bridge_object_register(Eo *bridge, Eo *obj)
4394{ 4414{
4395 Eldbus_Message *sig;
4396 Eldbus_Message_Iter *iter;
4397
4398 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd); 4415 ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
4399 4416
4400 if (!eo_isa(obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN)) 4417 if (!eo_isa(obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
@@ -4404,18 +4421,9 @@ static void _bridge_object_register(Eo *bridge, Eo *obj)
4404 } 4421 }
4405 4422
4406 if (eina_hash_find(pd->cache, &obj)) 4423 if (eina_hash_find(pd->cache, &obj))
4407 {
4408 WRN("Object %p already registered", obj);
4409 return; 4424 return;
4410 }
4411 4425
4412 eina_hash_add(pd->cache, &obj, obj); 4426 eina_hash_add(pd->cache, &obj, obj);
4413
4414 sig = eldbus_service_signal_new(pd->cache_interface, ATSPI_OBJECT_CHILD_ADDED);
4415 iter = eldbus_message_iter_get(sig);
4416 _cache_item_reference_append_cb(bridge, obj, iter);
4417
4418 eldbus_service_signal_send(pd->cache_interface, sig);
4419} 4427}
4420 4428
4421void 4429void