From 9bb2df996642f046f79466cff8fefcd43d28921e Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Mon, 11 Nov 2019 16:38:08 +0000 Subject: [PATCH] Unify "animated" flags There exist several flags to indicate whether an object should be animated, with inconsistent names: Efl.Canvas.Layout.animation: bool indicating if Edje animations should be played Efl.Ui.Spotlight_Manager.animation_enabled: bool indicating if page transitions should be animated Efl.Canvas.Animation_Player.animation: Efl.Canvas.Animation object This commit unifies all of them: "animated" is now a flag, and "animation" is an object. Note: Animation_Player is in the process of being replaced by an "animation" property in the Efl.Canvas.Object, hence the need for non-clashing animation flags. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10645 --- src/bin/elementary/test_ui_spotlight.c | 4 ++-- src/lib/edje/edje_program.c | 4 ++-- src/lib/edje/efl_canvas_layout.eo | 2 +- src/lib/edje/efl_canvas_layout_eo.legacy.c | 4 ++-- src/lib/elementary/efl_ui_spotlight_container.c | 4 ++-- src/lib/elementary/efl_ui_spotlight_manager.eo | 8 +++++--- src/lib/elementary/efl_ui_spotlight_manager_plain.c | 4 ++-- src/lib/elementary/efl_ui_spotlight_manager_plain.eo | 2 +- src/lib/elementary/efl_ui_spotlight_manager_scroll.c | 4 ++-- src/lib/elementary/efl_ui_spotlight_manager_scroll.eo | 2 +- src/lib/elementary/efl_ui_spotlight_manager_stack.c | 4 ++-- src/lib/elementary/efl_ui_spotlight_manager_stack.eo | 2 +- src/tests/elementary/efl_ui_test_spotlight.c | 4 ++-- 13 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/bin/elementary/test_ui_spotlight.c b/src/bin/elementary/test_ui_spotlight.c index a41ab69be5..fe095ab879 100644 --- a/src/bin/elementary/test_ui_spotlight.c +++ b/src/bin/elementary/test_ui_spotlight.c @@ -513,7 +513,7 @@ _animation_cb(void *data, const Efl_Event *ev) { Params *params = data; - efl_ui_spotlight_manager_animation_enabled_set(efl_ui_spotlight_manager_get(params->spotlight), efl_ui_selectable_selected_get(ev->object)); + efl_ui_spotlight_manager_animated_transition_set(efl_ui_spotlight_manager_get(params->spotlight), efl_ui_selectable_selected_get(ev->object)); } static void @@ -536,7 +536,7 @@ view_animation_cb(void *data, ck = efl_add(EFL_UI_CHECK_CLASS, box); efl_event_callback_add(ck, EFL_UI_EVENT_SELECTED_CHANGED, _animation_cb, params); - efl_ui_selectable_selected_set(ck, efl_ui_spotlight_manager_animation_enabled_get(efl_ui_spotlight_manager_get(params->spotlight))); + efl_ui_selectable_selected_set(ck, efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(params->spotlight))); efl_text_set(ck, "Animation"); efl_pack_end(box, ck); efl_gfx_entity_visible_set(ck, 1); diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c index b047031da1..b1edd1fa2b 100644 --- a/src/lib/edje/edje_program.c +++ b/src/lib/edje/edje_program.c @@ -320,7 +320,7 @@ _efl_canvas_layout_efl_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Edje *ed, /* FIXDOC: Verify/Expand */ EOLIAN void -_efl_canvas_layout_animation_set(Eo *obj, Edje *ed, Eina_Bool on) +_efl_canvas_layout_animated_set(Eo *obj, Edje *ed, Eina_Bool on) { Eina_List *l; unsigned short i; @@ -390,7 +390,7 @@ break_prog: } EOLIAN Eina_Bool -_efl_canvas_layout_animation_get(const Eo *obj EINA_UNUSED, Edje *ed) +_efl_canvas_layout_animated_get(const Eo *obj EINA_UNUSED, Edje *ed) { if (!ed) return EINA_FALSE; if (ed->delete_me) return EINA_FALSE; diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index bed3439d36..ef33c5bd8f 100644 --- a/src/lib/edje/efl_canvas_layout.eo +++ b/src/lib/edje/efl_canvas_layout.eo @@ -10,7 +10,7 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. event_c_prefix: efl_layout; data: Edje; methods { - @property animation { + @property animated { [[Whether this object is animating or not. This property indicates whether animations are stopped or not. diff --git a/src/lib/edje/efl_canvas_layout_eo.legacy.c b/src/lib/edje/efl_canvas_layout_eo.legacy.c index f55e5d5f4b..ec6eb8930d 100644 --- a/src/lib/edje/efl_canvas_layout_eo.legacy.c +++ b/src/lib/edje/efl_canvas_layout_eo.legacy.c @@ -2,13 +2,13 @@ EAPI void edje_object_animation_set(Efl_Canvas_Layout *obj, Eina_Bool on) { - efl_canvas_layout_animation_set(obj, on); + efl_canvas_layout_animated_set(obj, on); } EAPI Eina_Bool edje_object_animation_get(const Efl_Canvas_Layout *obj) { - return efl_canvas_layout_animation_get(obj); + return efl_canvas_layout_animated_get(obj); } EAPI Efl_Input_Device * diff --git a/src/lib/elementary/efl_ui_spotlight_container.c b/src/lib/elementary/efl_ui_spotlight_container.c index 608aca1d3c..f725f4830c 100644 --- a/src/lib/elementary/efl_ui_spotlight_container.c +++ b/src/lib/elementary/efl_ui_spotlight_container.c @@ -229,7 +229,7 @@ _efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Contai } else { - efl_ui_spotlight_manager_animation_enabled_set(manager, EINA_TRUE); + efl_ui_spotlight_manager_animated_transition_set(manager, EINA_TRUE); } return obj; @@ -619,7 +619,7 @@ _efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Cont //the api indicates that the caller passes ownership to this function, so we need to unref here efl_unref(pd->transition); //disable animation when not finalized yet, this help reducing the overhead of scheduling a animation that will not be displayed - efl_ui_spotlight_manager_animation_enabled_set(pd->transition, efl_finalized_get(obj)); + efl_ui_spotlight_manager_animated_transition_set(pd->transition, efl_finalized_get(obj)); efl_ui_spotlight_manager_bind(pd->transition, obj, pd->page_root); efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz); diff --git a/src/lib/elementary/efl_ui_spotlight_manager.eo b/src/lib/elementary/efl_ui_spotlight_manager.eo index 03f0e4fc35..ddb1ac1041 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager.eo +++ b/src/lib/elementary/efl_ui_spotlight_manager.eo @@ -55,10 +55,12 @@ abstract @beta Efl.Ui.Spotlight.Manager extends Efl.Object { size : Eina.Size2D; [[The new size of the sub-widgets.]] } } - @property animation_enabled @pure_virtual { - [[This flag can be used to disable animations.]] + @property animated_transition @pure_virtual { + [[When this flag is $true the transition from the previous element to the new one will be animated whenever + @Efl.Ui.Spotlight.Container.active_element changes.]] values { - enable : bool; [[$true if you want animations to happen, $false otherwise.]] + enable : bool; [[$true to enable animated transitions. If $false, the new active element is shown + immediately.]] } } } diff --git a/src/lib/elementary/efl_ui_spotlight_manager_plain.c b/src/lib/elementary/efl_ui_spotlight_manager_plain.c index f7d81335d6..50371ed3fc 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_plain.c +++ b/src/lib/elementary/efl_ui_spotlight_manager_plain.c @@ -157,13 +157,13 @@ _efl_ui_spotlight_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_ } EOLIAN static void -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Eina_Bool animation) +_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Eina_Bool animation) { pd->animation = animation; } EOLIAN static Eina_Bool -_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd) +_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd) { return pd->animation; } diff --git a/src/lib/elementary/efl_ui_spotlight_manager_plain.eo b/src/lib/elementary/efl_ui_spotlight_manager_plain.eo index 3556145da2..fd4f5d9664 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_plain.eo +++ b/src/lib/elementary/efl_ui_spotlight_manager_plain.eo @@ -6,7 +6,7 @@ class @beta Efl.Ui.Spotlight.Manager_Plain extends Efl.Ui.Spotlight.Manager Efl.Ui.Spotlight.Manager.content_del; Efl.Ui.Spotlight.Manager.switch_to; Efl.Ui.Spotlight.Manager.size {set;} - Efl.Ui.Spotlight.Manager.animation_enabled {set; get;} + Efl.Ui.Spotlight.Manager.animated_transition {set; get;} Efl.Object.destructor; } } diff --git a/src/lib/elementary/efl_ui_spotlight_manager_scroll.c b/src/lib/elementary/efl_ui_spotlight_manager_scroll.c index 1728c269d1..34baa3fbfb 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_scroll.c +++ b/src/lib/elementary/efl_ui_spotlight_manager_scroll.c @@ -305,7 +305,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_size_set(Eo *obj EINA_ } EOLIAN static void -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Bool animation) +_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Bool animation) { pd->animation = animation; if (pd->transition.active && !animation) @@ -317,7 +317,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animation_enabled_set( } EOLIAN static Eina_Bool -_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd) +_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd) { return pd->animation; } diff --git a/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo b/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo index 16ba58db2f..c9a8e7ad34 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo +++ b/src/lib/elementary/efl_ui_spotlight_manager_scroll.eo @@ -21,7 +21,7 @@ class @beta Efl.Ui.Spotlight.Manager_Scroll extends Efl.Ui.Spotlight.Manager Efl.Ui.Spotlight.Manager.content_del; Efl.Ui.Spotlight.Manager.switch_to; Efl.Ui.Spotlight.Manager.size {set;} - Efl.Ui.Spotlight.Manager.animation_enabled {set; get;} + Efl.Ui.Spotlight.Manager.animated_transition {set; get;} Efl.Object.invalidate; } } diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.c b/src/lib/elementary/efl_ui_spotlight_manager_stack.c index 811a686194..16e721560f 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_stack.c +++ b/src/lib/elementary/efl_ui_spotlight_manager_stack.c @@ -262,7 +262,7 @@ _reset_player(Efl_Animation_Player *player, Eina_Bool vis) } EOLIAN static void -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Eina_Bool animation) +_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animated_transition_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Eina_Bool animation) { _reset_player(pd->hide, EINA_FALSE); _reset_player(pd->show, EINA_TRUE); @@ -270,7 +270,7 @@ _efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animation_enabled_set(E } EOLIAN static Eina_Bool -_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd) +_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animated_transition_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd) { return pd->animation; } diff --git a/src/lib/elementary/efl_ui_spotlight_manager_stack.eo b/src/lib/elementary/efl_ui_spotlight_manager_stack.eo index c18fe31a8a..2275eb8ff0 100644 --- a/src/lib/elementary/efl_ui_spotlight_manager_stack.eo +++ b/src/lib/elementary/efl_ui_spotlight_manager_stack.eo @@ -6,7 +6,7 @@ class @beta Efl.Ui.Spotlight.Manager_Stack extends Efl.Ui.Spotlight.Manager Efl.Ui.Spotlight.Manager.content_del; Efl.Ui.Spotlight.Manager.switch_to; Efl.Ui.Spotlight.Manager.size {set;} - Efl.Ui.Spotlight.Manager.animation_enabled {set; get;} + Efl.Ui.Spotlight.Manager.animated_transition {set; get;} Efl.Object.invalidate; } } diff --git a/src/tests/elementary/efl_ui_test_spotlight.c b/src/tests/elementary/efl_ui_test_spotlight.c index c093efb46b..02edfcb652 100644 --- a/src/tests/elementary/efl_ui_test_spotlight.c +++ b/src/tests/elementary/efl_ui_test_spotlight.c @@ -197,8 +197,8 @@ _transition_animation_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) } EFL_OPS_DEFINE(transition_tracker, - EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animation_enabled_set, _transition_animation_set), - EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animation_enabled_get, _transition_animation_get), + EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animated_transition_set, _transition_animation_set), + EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animated_transition_get, _transition_animation_get), EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_add, _transition_content_add), EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_del, _transition_content_del), EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_switch_to, _transition_request_switch),