summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-09-03 14:07:23 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-10-01 16:00:28 +0200
commitf15796036e8f128207b68c045acaa6561d947e1f (patch)
tree3d6b3cb22c9c6475ff75a3bb4f71b410aaa5f27b /legacy/elementary/src/lib/elm_interface_atspi_accessible.c
parent59fc5e1643764abbce5154d06de7bb85c619a087 (diff)
atspi: add global event emitter
Introduce global event emitter for accessibility events. With such emitter there is no need to register array of callbacks on every accessibility object.
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/lib/elm_interface_atspi_accessible.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/legacy/elementary/src/lib/elm_interface_atspi_accessible.c b/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
index 36e0cc042a..3524008951 100644
--- a/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
+++ b/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
@@ -115,6 +115,13 @@ const char* Atspi_Name[] = {
115 "last defined" 115 "last defined"
116}; 116};
117 117
118struct _Elm_Atspi_Event_Handler
119{
120 Eo_Event_Cb cb;
121 void *data;
122};
123
124static Eina_List *global_callbacks;
118 125
119EOLIAN static int 126EOLIAN static int
120_elm_interface_atspi_accessible_index_in_parent_get(Eo *obj, void *pd EINA_UNUSED) 127_elm_interface_atspi_accessible_index_in_parent_get(Eo *obj, void *pd EINA_UNUSED)
@@ -281,4 +288,52 @@ EAPI void elm_atspi_attributes_list_free(Eina_List *list)
281 } 288 }
282} 289}
283 290
291EOLIAN void
292_elm_interface_atspi_accessible_event_emit(Eo *class EINA_UNUSED, void *pd EINA_UNUSED, Eo *accessible, const Eo_Event_Description *event, void *event_info)
293{
294 Eina_List *l;
295 Elm_Atspi_Event_Handler *hdl;
296
297 if (!accessible || !event || !eo_isa(accessible, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
298 {
299 CRI("Invalid accessibility event emit parameters");
300 return;
301 }
302
303 EINA_LIST_FOREACH(global_callbacks, l, hdl)
304 {
305 if (hdl->cb)
306 hdl->cb(hdl->data, accessible, event, event_info);
307 }
308}
309
310EOLIAN Elm_Atspi_Event_Handler *
311_elm_interface_atspi_accessible_event_handler_add(Eo *class EINA_UNUSED, void *pd EINA_UNUSED, Eo_Event_Cb cb, void *data)
312{
313 Elm_Atspi_Event_Handler *ret = calloc(sizeof(Elm_Atspi_Event_Handler), 1);
314
315 ret->cb = cb;
316 ret->data = data;
317
318 global_callbacks = eina_list_append(global_callbacks, ret);
319
320 return ret;
321}
322
323EOLIAN void
324_elm_interface_atspi_accessible_event_handler_del(Eo *class EINA_UNUSED, void *pd EINA_UNUSED, Elm_Atspi_Event_Handler *handler)
325{
326 Eina_List *l, *l2;
327 Elm_Atspi_Event_Handler *hdl;
328 EINA_LIST_FOREACH_SAFE(global_callbacks, l, l2, hdl)
329 {
330 if (hdl == handler)
331 {
332 global_callbacks = eina_list_remove_list(global_callbacks, l);
333 free(hdl);
334 break;
335 }
336 }
337}
338
284#include "elm_interface_atspi_accessible.eo.c" 339#include "elm_interface_atspi_accessible.eo.c"