summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@free.fr>2019-10-31 09:17:40 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-31 10:00:02 -0400
commit783e566b69b14317b517e5fd85c26b6736202b8b (patch)
tree90bef7e41b14e605a2f61d05f65f589bc66df63c
parent2c9cace0265608e670dfa9a06b0d92ef6628a8bc (diff)
edje: improve callback count on Evas canvas.
Summary: This reduce by 3 the amount of callback registered on the canvas. Another potential improvement would be to only register those callback if someone is listening for a 'seat,*' event or if the edje file define seat filters. Depends on D10484 Reviewers: zmike, raster, bu5hm4n, Hermet Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10486
-rw-r--r--src/lib/edje/edje_load.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 5bfd11fb82..0c43475bf5 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -646,18 +646,28 @@ _edje_device_changed_cb(void *data, const Efl_Event *event)
646 _edje_seat_event_filter_apply(ed, seat); 646 _edje_seat_event_filter_apply(ed, seat);
647} 647}
648 648
649static void _edje_device_canvas_del(void *data, const Efl_Event *event);
650
651EFL_CALLBACKS_ARRAY_DEFINE(edje_device_callbacks,
652 { EFL_CANVAS_SCENE_EVENT_DEVICE_ADDED, _edje_device_added_cb },
653 { EFL_CANVAS_SCENE_EVENT_DEVICE_REMOVED, _edje_device_removed_cb },
654 { EFL_EVENT_DEL, _edje_device_canvas_del });
655
656EFL_CALLBACKS_ARRAY_DEFINE(edje_device_custom_callbacks,
657 { EFL_CANVAS_SCENE_EVENT_DEVICE_CHANGED, _edje_device_changed_cb },
658 { EFL_CANVAS_SCENE_EVENT_DEVICE_ADDED, _edje_device_added_cb },
659 { EFL_CANVAS_SCENE_EVENT_DEVICE_REMOVED, _edje_device_removed_cb },
660 { EFL_EVENT_DEL, _edje_device_canvas_del });
661
649static void 662static void
650_edje_device_canvas_del(void *data, const Efl_Event *event) 663_edje_device_canvas_del(void *data, const Efl_Event *event)
651{ 664{
652 Edje *ed = data; 665 Edje *ed = data;
653 efl_event_callback_del(event->object, EFL_CANVAS_SCENE_EVENT_DEVICE_ADDED,
654 _edje_device_added_cb, ed);
655 efl_event_callback_del(event->object, EFL_CANVAS_SCENE_EVENT_DEVICE_REMOVED,
656 _edje_device_removed_cb, ed);
657 666
658 if (ed->collection && ed->collection->use_custom_seat_names) 667 if (ed->collection && ed->collection->use_custom_seat_names)
659 efl_event_callback_del(event->object, EFL_CANVAS_SCENE_EVENT_DEVICE_CHANGED, 668 efl_event_callback_array_del(event->object, edje_device_custom_callbacks(), ed);
660 _edje_device_changed_cb, ed); 669 else
670 efl_event_callback_array_del(event->object, edje_device_callbacks(), ed);
661} 671}
662 672
663static void 673static void
@@ -672,16 +682,11 @@ _edje_devices_add(Edje *ed, Evas *tev)
672 if (efl_input_device_type_get(dev) == EFL_INPUT_DEVICE_TYPE_SEAT) 682 if (efl_input_device_type_get(dev) == EFL_INPUT_DEVICE_TYPE_SEAT)
673 _edje_device_add(ed, dev); 683 _edje_device_add(ed, dev);
674 } 684 }
675 efl_event_callback_add(tev, EFL_EVENT_DEL, _edje_device_canvas_del, ed);
676
677 efl_event_callback_add(tev, EFL_CANVAS_SCENE_EVENT_DEVICE_ADDED,
678 _edje_device_added_cb, ed);
679 efl_event_callback_add(tev, EFL_CANVAS_SCENE_EVENT_DEVICE_REMOVED,
680 _edje_device_removed_cb, ed);
681 685
682 if (ed->collection && ed->collection->use_custom_seat_names) 686 if (ed->collection && ed->collection->use_custom_seat_names)
683 efl_event_callback_add(tev, EFL_CANVAS_SCENE_EVENT_DEVICE_CHANGED, 687 efl_event_callback_array_add(tev, edje_device_custom_callbacks(), ed);
684 _edje_device_changed_cb, ed); 688 else
689 efl_event_callback_array_add(tev, edje_device_callbacks(), ed);
685} 690}
686 691
687static inline void 692static inline void
@@ -1880,14 +1885,10 @@ _edje_file_callbacks_del(Edje *ed, Evas *e)
1880 Evas *tev = e; 1885 Evas *tev = e;
1881 1886
1882 if (!tev) tev = evas_object_evas_get(ed->obj); 1887 if (!tev) tev = evas_object_evas_get(ed->obj);
1883 efl_event_callback_del(tev, EFL_EVENT_DEL, _edje_device_canvas_del, ed);
1884 efl_event_callback_del(tev, EFL_CANVAS_SCENE_EVENT_DEVICE_ADDED,
1885 _edje_device_added_cb, ed);
1886 efl_event_callback_del(tev, EFL_CANVAS_SCENE_EVENT_DEVICE_REMOVED,
1887 _edje_device_removed_cb, ed);
1888 if (ed->collection && ed->collection->use_custom_seat_names) 1888 if (ed->collection && ed->collection->use_custom_seat_names)
1889 efl_event_callback_del(tev, EFL_CANVAS_SCENE_EVENT_DEVICE_CHANGED, 1889 efl_event_callback_array_del(tev, edje_device_custom_callbacks(), ed);
1890 _edje_device_changed_cb, ed); 1890 else
1891 efl_event_callback_array_del(tev, edje_device_callbacks(), ed);
1891} 1892}
1892 1893
1893void 1894void