cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=cd1f5915d2ca855eff1afcc341a051cec1d40e16
commit cd1f5915d2ca855eff1afcc341a051cec1d40e16 Author: Cedric Bail <ced...@osg.samsung.com> Date: Wed Nov 15 15:08:32 2017 -0800 elementary: add an interface to enable/disable PAUSE/RESUME application state. If you want to have EFL application behave in a more efficient way. Like dropping memory usage or stopping unecessary network operation, this option should be on and the application should listen on PAUSE/RESUME event on the main loop. --- src/bin/elementary/config.c | 20 ++++++++++++++++++++ src/lib/elementary/elm_config.c | 18 ++++++++++++++++++ src/lib/elementary/elm_config.h | 20 ++++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/src/bin/elementary/config.c b/src/bin/elementary/config.c index 7e603772a1..8870ad7609 100644 --- a/src/bin/elementary/config.c +++ b/src/bin/elementary/config.c @@ -3963,6 +3963,19 @@ _cb_vsync(void *data EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED) } static void +_cb_withdrawn(void *data EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED) +{ + Eina_Bool val = elm_check_state_get(obj); + Eina_Bool sb = elm_config_agressive_withdrawn_get(); + + if (val != sb) + { + elm_config_agressive_withdrawn_set(val); + elm_config_all_flush(); + } +} + +static void _status_config_rendering(Evas_Object *win, Evas_Object *naviframe) { @@ -4030,6 +4043,13 @@ _status_config_rendering(Evas_Object *win, _cb_vsync, NULL); elm_check_state_set(ck, elm_config_vsync_get()); + CHECK_ADD("Aggressive withdrawn", + "When the application is iconified it will<br>" + "drop its ressource and switch to a paused state<br>" + "if the application handle that lifecycle state.", + _cb_withdrawn, NULL); + elm_check_state_set(ck, elm_config_agressive_withdrawn_get()); + evas_object_data_set(win, "rendering", bx); elm_naviframe_item_simple_push(naviframe, bx); } diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c index 26cddfba46..4c312b3107 100644 --- a/src/lib/elementary/elm_config.c +++ b/src/lib/elementary/elm_config.c @@ -3359,6 +3359,24 @@ elm_config_vsync_set(Eina_Bool enabled) } EAPI Eina_Bool +elm_config_agressive_withdrawn_get(void) +{ + return _elm_config->auto_norender_withdrawn && + _elm_config->auto_norender_iconified_same_as_withdrawn && + _elm_config->auto_flush_withdrawn && + _elm_config->auto_dump_withdrawn; +} + +EAPI void +elm_config_agressive_withdrawn_set(Eina_Bool enabled) +{ + _elm_config->auto_norender_withdrawn = enabled; + _elm_config->auto_norender_iconified_same_as_withdrawn = enabled; + _elm_config->auto_flush_withdrawn = enabled; + _elm_config->auto_dump_withdrawn = enabled; +} + +EAPI Eina_Bool elm_config_accel_preference_override_get(void) { return _elm_config->accel_override; diff --git a/src/lib/elementary/elm_config.h b/src/lib/elementary/elm_config.h index 019975d721..aa83915d1b 100644 --- a/src/lib/elementary/elm_config.h +++ b/src/lib/elementary/elm_config.h @@ -1542,6 +1542,26 @@ EAPI Eina_Bool elm_config_vsync_get(void); EAPI void elm_config_vsync_set(Eina_Bool enabled); /** + * Get the configure flag that will define if a window agressively drop its + * ressource when minimized. + * + * @return if it does. + * + * @since 1.21 + */ +EAPI Eina_Bool elm_config_agressive_withdrawn_get(void); + +/** + * Set the configure flag that will make a window agressively drop its + * ressource when minimized. + * + * @param enabled This should be @c EINA_TRUE if enabled, or @c EINA_FALSE if + * not. + * @since 1.21 + */ +EAPI void elm_config_agressive_withdrawn_set(Eina_Bool enabled); + +/** * Get the acceleration override preference flag * * This gets the acceleration override preference. This is a flag that --