summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman.samsung@gmail.com>2018-09-18 09:42:38 -0500
committerDerek Foreman <derek.foreman.samsung@gmail.com>2018-09-18 09:42:38 -0500
commit4dc1e8273d3ee2e118c6ec7bdf6135771688e662 (patch)
treeb68084a95b0d8652aa30184b557d4af35684e103 /src/lib/ecore
parent448c7ca2ce6485d885b48407919e715de3365b28 (diff)
ecore: Add new way to register animators
Summary: We have back-ends that can generate their own tick sources, but ecore_animator_add()/ecore_animator_timeline_add() gives no indication which backend the animator is running on. This means that all animators have to cause all currently in use backends to tick. For example, if under wayland 4 application windows are open, all 4 windows will create ticks when any animator is present. These new animator APIs that take an evas object allow us to figure out out the backend and only cause the appropriate one to tick. Depends on D7040 Reviewers: devilhorns Reviewed By: devilhorns Subscribers: devilhorns, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7041
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/Ecore_Legacy.h5
-rw-r--r--src/lib/ecore/ecore_anim.c68
-rw-r--r--src/lib/ecore/ecore_private.h13
3 files changed, 75 insertions, 11 deletions
diff --git a/src/lib/ecore/Ecore_Legacy.h b/src/lib/ecore/Ecore_Legacy.h
index a9931874c5..fb5b2a746a 100644
--- a/src/lib/ecore/Ecore_Legacy.h
+++ b/src/lib/ecore/Ecore_Legacy.h
@@ -391,4 +391,9 @@ EAPI void *ecore_job_del(Ecore_Job *obj);
391 * @} 391 * @}
392 */ 392 */
393 393
394#ifdef EFL_BETA_API_SUPPORT
395EAPI Ecore_Animator *ecore_evas_animator_timeline_add(void *evo, double runtime, Ecore_Timeline_Cb func, const void *data);
396EAPI Ecore_Animator *ecore_evas_animator_add(void *evo, Ecore_Task_Cb func, const void *data);
397#endif /* EFL_BETA_API_SUPPORT */
398
394#endif 399#endif
diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c
index 337df5f1ca..9fbcf67b82 100644
--- a/src/lib/ecore/ecore_anim.c
+++ b/src/lib/ecore/ecore_anim.c
@@ -44,6 +44,7 @@
44#include "ecore_private.h" 44#include "ecore_private.h"
45 45
46static int _ecore_anim_log_dom = -1; 46static int _ecore_anim_log_dom = -1;
47static Eina_Bool _ee_animators_setup = EINA_FALSE;
47 48
48#ifdef ERR 49#ifdef ERR
49# undef ERR 50# undef ERR
@@ -98,6 +99,8 @@ static Eina_Bool tick_skip = EINA_FALSE;
98extern volatile int exit_signal_received; 99extern volatile int exit_signal_received;
99#endif 100#endif
100 101
102static Ecore_Evas_Object_Animator_Interface _anim_iface;
103
101static void 104static void
102_tick_send(signed char val) 105_tick_send(signed char val)
103{ 106{
@@ -815,6 +818,8 @@ ecore_animator_del(Ecore_Animator *animator)
815 if (!animator) return NULL; 818 if (!animator) return NULL;
816 EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); 819 EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
817 820
821 if (animator->ee) return _anim_iface.del(animator);
822
818 if (animator->delete_me) 823 if (animator->delete_me)
819 { 824 {
820 data = animator->data; 825 data = animator->data;
@@ -855,28 +860,36 @@ EAPI void
855ecore_animator_freeze(Ecore_Animator *animator) 860ecore_animator_freeze(Ecore_Animator *animator)
856{ 861{
857 EINA_MAIN_LOOP_CHECK_RETURN; 862 EINA_MAIN_LOOP_CHECK_RETURN;
858 if (!animator) return ; 863 if (!animator) return;
859 if (animator->delete_me) return ; 864 if (animator->delete_me) return;
860 if (!animator->suspended) 865 if (animator->suspended) return;
866
867 if (animator->ee)
861 { 868 {
862 animator->suspended = EINA_TRUE; 869 _anim_iface.freeze(animator);
863 animators_suspended++; 870 return;
864 if (!_have_animators()) _end_tick();
865 } 871 }
872 animator->suspended = EINA_TRUE;
873 animators_suspended++;
874 if (!_have_animators()) _end_tick();
866} 875}
867 876
868EAPI void 877EAPI void
869ecore_animator_thaw(Ecore_Animator *animator) 878ecore_animator_thaw(Ecore_Animator *animator)
870{ 879{
871 EINA_MAIN_LOOP_CHECK_RETURN; 880 EINA_MAIN_LOOP_CHECK_RETURN;
872 if (!animator) return ; 881 if (!animator) return;
873 if (animator->delete_me) return; 882 if (animator->delete_me) return;
874 if (animator->suspended) 883 if (!animator->suspended) return;
884
885 if (animator->ee)
875 { 886 {
876 animator->suspended = EINA_FALSE; 887 _anim_iface.thaw(animator);
877 animators_suspended--; 888 return;
878 if (_have_animators()) _begin_tick();
879 } 889 }
890 animator->suspended = EINA_FALSE;
891 animators_suspended--;
892 if (_have_animators()) _begin_tick();
880} 893}
881 894
882EAPI void 895EAPI void
@@ -1030,3 +1043,36 @@ _ecore_animator_init(void)
1030 EINA_LOG_ERR("Ecore was unable to create a log domain."); 1043 EINA_LOG_ERR("Ecore was unable to create a log domain.");
1031 } 1044 }
1032} 1045}
1046
1047void
1048ecore_evas_object_animator_init(Ecore_Evas_Object_Animator_Interface *iface)
1049{
1050 _anim_iface = *iface;
1051 _ee_animators_setup = EINA_TRUE;
1052}
1053
1054Ecore_Animator *
1055ecore_evas_animator_timeline_add(void *evo, double runtime, Ecore_Timeline_Cb func, const void *data)
1056{
1057 Ecore_Animator *anim = NULL;
1058
1059 if (_ee_animators_setup)
1060 anim = _anim_iface.timeline_add(evo, runtime, func, data);
1061
1062 if (anim) return anim;
1063
1064 return ecore_animator_timeline_add(runtime, func, data);
1065}
1066
1067Ecore_Animator *
1068ecore_evas_animator_add(void *evo, Ecore_Task_Cb func, const void *data)
1069{
1070 Ecore_Animator *anim = NULL;
1071
1072 if (_ee_animators_setup)
1073 anim = _anim_iface.add(evo, func, data);
1074
1075 if (anim) return anim;
1076
1077 return ecore_animator_add(func, data);
1078}
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index b886de38c4..c29f73d189 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -220,11 +220,24 @@ struct _Ecore_Animator
220 Ecore_Timeline_Cb run_func; 220 Ecore_Timeline_Cb run_func;
221 void *run_data; 221 void *run_data;
222 222
223 void *ee;
224
223 Eina_Bool delete_me : 1; 225 Eina_Bool delete_me : 1;
224 Eina_Bool suspended : 1; 226 Eina_Bool suspended : 1;
225 Eina_Bool just_added : 1; 227 Eina_Bool just_added : 1;
226}; 228};
227 229
230typedef struct _Ecore_Evas_Object_Animator_Interface
231{
232 Ecore_Animator *(*timeline_add)(void *obj, double runtime, Ecore_Timeline_Cb func, const void *data);
233 Ecore_Animator *(*add)(void *obj, Ecore_Task_Cb func, const void *data);
234 void (*freeze)(Ecore_Animator *animator);
235 void (*thaw)(Ecore_Animator *animator);
236 void *(*del)(Ecore_Animator *animator);
237} Ecore_Evas_Object_Animator_Interface;
238
239EAPI void ecore_evas_object_animator_init(Ecore_Evas_Object_Animator_Interface *iface);
240
228#define EVAS_FRAME_QUEUING 1 /* for test */ 241#define EVAS_FRAME_QUEUING 1 /* for test */
229 242
230#define READBUFSIZ 65536 243#define READBUFSIZ 65536