On 06/17/2011 04:35 PM, Mathieu Taillefumier wrote: > On 06/17/2011 10:27 PM, Christopher Michael wrote: >> On 06/17/2011 03:55 PM, Mathieu Taillefumier wrote: >>> Hi, >>> >>> I finished to write the code implementing the automatic backlight >>> reduction after a given time of inactivity (that can be set in the >>> backlight menu). The patch is relatively straightforward but reviewing >>> is always welcome so fire up. To have the automatic backlight just set >>> the Dimming time to a non zero value. The automatic dimming is disabled >>> when the dimming time is 0. >>> >>> >>> Mathieu >>> >> Just one observation wrt this patch. The formatting for 'if' statements >> is not correct. It should be something like this: >> >> if (_bl_log_dom< 0) >> >> with a space after the 'if'. > > And !!! Corrected but it does not improve it. > > Mathieu >>
Hmm, I still see several 'if' statements that are not corrected ;) and Yes, it will not change functionality of the patch, but does improve readability if it matches the rest of the EFL ;) dh >> dh >> >>> backlight.patch >>> >>> >>> author : Mathieu Taillefumier (mathieu.taillefum...@free.fr) >>> >>> Add automatic backlight dimming. >>> - two parameters are added : >>> - sleep backlight is the backlight minimum during extensive >>> inactivity time (6 min) >>> - dimming timeout : Time of inactivity after what the backlight is >>> reduced to the idle backlight intensity >>> >>> bin/e_backlight.c | 181 +++++++++++++++++++++++++++---- >>> bin/e_config.c | 4 >>> bin/e_config.h | 3 >>> modules/conf_display/e_int_config_dpms.c | 39 ++++++ >>> 4 files changed, 204 insertions(+), 23 deletions(-) >>> Index: src/bin/e_config.c >>> =================================================================== >>> --- src/bin/e_config.c (revision 60455) >>> +++ src/bin/e_config.c (working copy) >>> @@ -909,7 +909,9 @@ >>> E_CONFIG_VAL(D, T, backlight.normal, DOUBLE); >>> E_CONFIG_VAL(D, T, backlight.dim, DOUBLE); >>> E_CONFIG_VAL(D, T, backlight.transition, DOUBLE); >>> - >>> + E_CONFIG_VAL(D, T, backlight.sleep, DOUBLE); >>> + E_CONFIG_VAL(D, T, backlight.dimming_timer, DOUBLE); >>> + E_CONFIG_VAL(D, T, backlight.dimming_enable, INT); >>> e_config_load(); >>> >>> e_config_save_queue(); >>> Index: src/bin/e_config.h >>> =================================================================== >>> --- src/bin/e_config.h (revision 60455) >>> +++ src/bin/e_config.h (working copy) >>> @@ -347,7 +347,10 @@ >>> struct { >>> double normal; >>> double dim; >>> + double sleep; >>> double transition; >>> + double dimming_timer; >>> + Eina_Bool dimming_enable; >>> } backlight; >>> }; >>> >>> Index: src/bin/e_backlight.c >>> =================================================================== >>> --- src/bin/e_backlight.c (revision 60455) >>> +++ src/bin/e_backlight.c (working copy) >>> @@ -6,6 +6,7 @@ >>> >>> #define MODE_RANDR 0 >>> #define MODE_SYS 1 >>> +#define MODE_NONE 2 >>> >>> static double bl_val = 1.0; >>> static double bl_animval = 1.0; >>> @@ -16,6 +17,9 @@ >>> static Ecore_Event_Handler *bl_sys_exit_handler = NULL; >>> static Ecore_Exe *bl_sys_set_exe = NULL; >>> static Eina_Bool bl_sys_pending_set = EINA_FALSE; >>> +static Ecore_Poller *_bl_dimming_poll_activity_check = NULL; >>> +static Eina_Bool _backlight_reduced_level_set = EINA_FALSE; >>> +static int _bl_log_dom = -1; >>> >>> static void _e_backlight_update(E_Zone *zone); >>> static void _e_backlight_set(E_Zone *zone, double val); >>> @@ -26,10 +30,42 @@ >>> static void _bl_sys_level_get(void); >>> static Eina_Bool _e_bl_cb_exit(void *data __UNUSED__, int type >>> __UNUSED__, void *event); >>> static void _bl_sys_level_set(double val); >>> +static Eina_Bool _bl_poll_activity_check(void *data __UNUSED__); >>> >>> +#ifdef ERR >>> +# undef ERR >>> +#endif /* ifdef ERR */ >>> +#define ERR(...) EINA_LOG_DOM_ERR(_bl_log_dom, __VA_ARGS__) >>> +#ifdef DBG >>> +# undef DBG >>> +#endif /* ifdef DBG */ >>> +#define DBG(...) EINA_LOG_DOM_DBG(_bl_log_dom, __VA_ARGS__) >>> +#ifdef INF >>> +# undef INF >>> +#endif /* ifdef INF */ >>> +#define INF(...) EINA_LOG_DOM_INFO(_bl_log_dom, __VA_ARGS__) >>> +#ifdef WRN >>> +# undef WRN >>> +#endif /* ifdef WRN */ >>> +#define WRN(...) EINA_LOG_DOM_WARN(_bl_log_dom, __VA_ARGS__) >>> +#ifdef CRIT >>> +# undef CRIT >>> +#endif /* ifdef CRIT */ >>> +#define CRIT(...) EINA_LOG_DOM_CRIT(_bl_log_dom, __VA_ARGS__) >>> + >>> EINTERN int >>> e_backlight_init(void) >>> { >>> + if(_bl_log_dom< 0) >>> + { >>> + _bl_log_dom = eina_log_domain_register("E17 Backlight", >>> EINA_COLOR_BLUE); >>> + if(_bl_log_dom< 0) >>> + { >>> + EINA_LOG_ERR("Enable to create a log domain for the backlight >>> extension"); >>> + return 0; >>> + } >>> + } >>> + >>> e_backlight_update(); >>> e_backlight_level_set(NULL, 0.0, 0.0); >>> e_backlight_level_set(NULL, e_config->backlight.normal, 1.0); >>> @@ -47,6 +83,13 @@ >>> bl_sys_exit_handler = NULL; >>> bl_sys_set_exe = NULL; >>> bl_sys_pending_set = EINA_FALSE; >>> + >>> + if(_bl_dimming_poll_activity_check) >>> + ecore_poller_del(_bl_dimming_poll_activity_check); >>> + _bl_dimming_poll_activity_check = NULL; >>> + >>> + eina_log_domain_unregister(_bl_log_dom); >>> + _bl_log_dom = -1; >>> return 1; >>> } >>> >>> @@ -68,7 +111,27 @@ >>> } >>> } >>> } >>> + >>> + /* >>> + * check if we want to have automatic decrease of the backlight >>> + * after some amount of time. >>> + */ >>> + if(e_config->backlight.dimming_enable) >>> + { >>> + if(!_bl_dimming_poll_activity_check) >>> + { >>> + _bl_dimming_poll_activity_check = >>> ecore_poller_add(ECORE_POLLER_CORE , 4, _bl_poll_activity_check, NULL); >>> } >>> + } >>> + else >>> + { >>> + if(_bl_dimming_poll_activity_check) >>> + { >>> + ecore_poller_del(_bl_dimming_poll_activity_check); >>> + _bl_dimming_poll_activity_check = NULL; >>> + } >>> + } >>> +} >>> >>> EAPI void >>> e_backlight_level_set(E_Zone *zone, double val, double tim) >>> @@ -114,17 +177,27 @@ >>> // zone == NULL == everything >>> if (bl_mode == mode) return; >>> bl_mode = mode; >>> - if (bl_mode == E_BACKLIGHT_MODE_NORMAL) >>> + switch(bl_mode) >>> + { >>> + case E_BACKLIGHT_MODE_NORMAL: >>> e_backlight_level_set(zone, bl_val, -1.0); >>> - else if (bl_mode == E_BACKLIGHT_MODE_OFF) >>> + break; >>> + case E_BACKLIGHT_MODE_OFF: >>> e_backlight_level_set(zone, 0.0, -1.0); >>> - else if (bl_mode == E_BACKLIGHT_MODE_DIM) >>> - e_backlight_level_set(zone, 0.0, -1.0); >>> - else if (bl_mode == E_BACKLIGHT_MODE_DIM) >>> + break; >>> + case E_BACKLIGHT_MODE_MIN: >>> + e_backlight_level_set(zone, e_config->backlight.sleep, -1.0); >>> + break; >>> + case E_BACKLIGHT_MODE_DIM: >>> e_backlight_level_set(zone, e_config->backlight.dim, -1.0); >>> - else if (bl_mode == E_BACKLIGHT_MODE_MAX) >>> + break; >>> + case E_BACKLIGHT_MODE_MAX: >>> e_backlight_level_set(zone, 1.0, -1.0); >>> + break; >>> + default: >>> + break; >>> } >>> +} >>> >>> EAPI E_Backlight_Mode >>> e_backlight_mode_get(E_Zone *zone __UNUSED__) >>> @@ -145,7 +218,7 @@ >>> >>> root = zone->container->manager->root; >>> // try randr >>> - out = ecore_x_randr_window_outputs_get(root,&num); >>> + out = ecore_x_randr_outputs_get(root,&num); >>> if ((out)&& (num> 0)) >>> x_bl = ecore_x_randr_output_backlight_level_get(root, out[0]); >>> if (out) free(out); >>> @@ -168,26 +241,23 @@ >>> static void >>> _e_backlight_set(E_Zone *zone, double val) >>> { >>> - if (sysmode == MODE_RANDR) >>> - { >>> Ecore_X_Window root; >>> - Ecore_X_Randr_Output *out; >>> - int num = 0; >>> >>> + switch(sysmode) >>> + { >>> + case MODE_RANDR: >>> root = zone->container->manager->root; >>> - out = ecore_x_randr_window_outputs_get(root,&num); >>> - if ((out)&& (num> 0)) >>> - { >>> - ecore_x_randr_output_backlight_level_set(root, out[0], val); >>> - } >>> - if (out) free(out); >>> - } >>> - else if (sysmode == MODE_SYS) >>> - { >>> + ecore_x_randr_screen_backlight_level_set(root, val); >>> + break; >>> + case MODE_SYS: >>> if (bl_sysval) >>> { >>> _bl_sys_level_set(val); >>> } >>> + break; >>> + default: >>> + WRN("No backlight properties for this screen"); >>> + break; >>> } >>> } >>> >>> @@ -348,3 +418,74 @@ >>> e_prefix_lib_get(), (int)(val * 1000.0)); >>> bl_sys_set_exe = ecore_exe_run(buf, NULL); >>> } >>> + >>> +static Eina_Bool _bl_poll_activity_check(void *data) >>> +{ >>> + Eina_List *list; >>> + Eina_List *iter; >>> + Eina_List *m, *c, *z; >>> + E_Manager *man; >>> + E_Container *con; >>> + E_Zone *zone; >>> + double timer = 0.0; >>> + E_Backlight_Mode tmp_mode = bl_mode; >>> + double val = 1.0; >>> + >>> + if((e_config->mode.presentation)&&(bl_mode != >>> E_BACKLIGHT_MODE_NORMAL)) >>> + { >>> + tmp_mode = E_BACKLIGHT_MODE_NORMAL; >>> + /* loop over the outputs */ >>> + EINA_LIST_FOREACH(e_manager_list(), m, man) >>> + { >>> + EINA_LIST_FOREACH(man->containers, c, con) >>> + { >>> + EINA_LIST_FOREACH(con->zones, z, zone) >>> + { >>> + _e_backlight_set(zone, e_config->backlight.normal); >>> + } >>> + } >>> + } >>> + bl_mode = E_BACKLIGHT_MODE_NORMAL; >>> + return EINA_TRUE; >>> + } >>> + >>> + /* read inactivity time */ >>> + timer = ecore_x_screensaver_idle_time_get(); >>> + >>> + if((timer> e_config->backlight.dimming_timer)&&(bl_mode == >>> E_BACKLIGHT_MODE_NORMAL)) >>> + { >>> + tmp_mode = E_BACKLIGHT_MODE_DIM; >>> + val = e_config->backlight.dim; >>> + } >>> + >>> + if(timer> 300) >>> + { >>> + tmp_mode = E_BACKLIGHT_MODE_MIN; >>> + val = e_config->backlight.sleep; >>> + } >>> + >>> + if((timer< e_config->backlight.dimming_timer)&&(bl_mode != >>> E_BACKLIGHT_MODE_NORMAL)) >>> + { >>> + tmp_mode = E_BACKLIGHT_MODE_NORMAL; >>> + val = e_config->backlight.normal; >>> + } >>> + >>> + if(tmp_mode != bl_mode) >>> + { >>> + /* loop over the outputs */ >>> + EINA_LIST_FOREACH(e_manager_list(), m, man) >>> + { >>> + EINA_LIST_FOREACH(man->containers, c, con) >>> + { >>> + EINA_LIST_FOREACH(con->zones, z, zone) >>> + { >>> + _e_backlight_set(zone, val); >>> + } >>> + } >>> + } >>> + } >>> + >>> + bl_mode = tmp_mode; >>> + >>> + return EINA_TRUE; >>> +} >>> Index: src/modules/conf_display/e_int_config_dpms.c >>> =================================================================== >>> --- src/modules/conf_display/e_int_config_dpms.c (revision 60455) >>> +++ src/modules/conf_display/e_int_config_dpms.c (working copy) >>> @@ -39,7 +39,10 @@ >>> >>> double backlight_normal; >>> double backlight_dim; >>> + double backlight_sleep; >>> double backlight_transition; >>> + double backlight_dimming_timer; >>> + Eina_Bool backlight_dimming_enable; >>> }; >>> >>> static E_Dialog *dpms_dialog = NULL; >>> @@ -65,6 +68,7 @@ >>> if (dpms_dialog) e_object_del(E_OBJECT(dpms_dialog)); >>> dpms_dialog = >>> e_dialog_new(e_container_current_get(e_manager_current_get()), >>> "E", "_dpms_capable_dialog"); >>> + >>> if (!dpms_dialog) return 0; >>> >>> e_dialog_title_set(dpms_dialog, _("Display Power Management >>> Signaling")); >>> @@ -141,7 +145,10 @@ >>> cfdata->off_timeout = e_config->dpms_off_timeout / 60; >>> cfdata->backlight_normal = e_config->backlight.normal * 100.0; >>> cfdata->backlight_dim = e_config->backlight.dim * 100.0; >>> + cfdata->backlight_sleep = e_config->backlight.sleep * 100.0; >>> cfdata->backlight_transition = e_config->backlight.transition; >>> + cfdata->backlight_dimming_timer = e_config->backlight.dimming_timer; >>> + cfdata->backlight_dimming_enable = e_config->backlight.dimming_enable; >>> } >>> >>> static void >>> @@ -191,11 +198,24 @@ >>> >>> e_config->backlight.normal = cfdata->backlight_normal / 100.0; >>> e_config->backlight.dim = cfdata->backlight_dim / 100.0; >>> + e_config->backlight.sleep = cfdata->backlight_sleep / 100.0; >>> + if(e_config->backlight.dim< e_config->backlight.sleep) >>> + { >>> + double tmp = e_config->backlight.dim; >>> + e_config->backlight.dim = e_config->backlight.sleep; >>> + e_config->backlight.sleep = tmp; >>> + } >>> + >>> e_config->backlight.transition = cfdata->backlight_transition; >>> + e_config->backlight.dimming_timer = cfdata->backlight_dimming_timer; >>> + if(e_config->backlight.dimming_timer> 0.1) >>> + e_config->backlight.dimming_enable = EINA_TRUE; >>> + else >>> + e_config->backlight.dimming_enable = EINA_FALSE; >>> >>> e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL); >>> e_backlight_level_set(NULL, e_config->backlight.normal, -1.0); >>> - >>> + e_backlight_update(); >>> e_config_save_queue(); >>> e_dpms_update(); >>> return 1; >>> @@ -214,7 +234,10 @@ >>> (e_config->dpms_off_timeout / 60 != cfdata->off_timeout) || >>> (e_config->backlight.normal * 100.0 != cfdata->backlight_normal) || >>> (e_config->backlight.dim * 100.0 != cfdata->backlight_dim) || >>> - (e_config->backlight.transition != cfdata->backlight_transition); >>> + (e_config->backlight.transition != cfdata->backlight_transition) || >>> + (e_config->backlight.sleep != cfdata->backlight_sleep) || >>> + (e_config->backlight.dimming_timer != >>> cfdata->backlight_dimming_timer) || >>> + (e_config->backlight.dimming_enable != >>> cfdata->backlight_dimming_enable); >>> } >>> >>> static int >>> @@ -301,12 +324,24 @@ >>> &(cfdata->backlight_dim), NULL, 100); >>> e_widget_list_object_append(o, ob, 1, 1, 0.5); >>> >>> + ob = e_widget_label_add(evas, _("Sleep Backlight")); >>> + e_widget_list_object_append(o, ob, 1, 1, 0.5); >>> + ob = e_widget_slider_add(evas, 1, 0, _("%3.0f"), 0.0, 100.0, 1.0, 0, >>> +&(cfdata->backlight_sleep), NULL, 100); >>> + e_widget_list_object_append(o, ob, 1, 1, 0.5); >>> + >>> ob = e_widget_label_add(evas, _("Fade Time")); >>> e_widget_list_object_append(o, ob, 1, 1, 0.5); >>> ob = e_widget_slider_add(evas, 1, 0, _("%1.1f sec"), 0.0, 5.0, 0.1, 0, >>> &(cfdata->backlight_transition), NULL, 100); >>> e_widget_list_object_append(o, ob, 1, 1, 0.5); >>> >>> + ob = e_widget_label_add(evas, _("Dimming Time")); >>> + e_widget_list_object_append(o, ob, 1, 1, 0.5); >>> + ob = e_widget_slider_add(evas, 1, 0, _("%1.1f sec"), 0.0, 120.0, >>> 0.1, 0, >>> +&(cfdata->backlight_dimming_timer), NULL, 100); >>> + e_widget_list_object_append(o, ob, 1, 1, 0.5); >>> + >>> e_widget_toolbook_page_append(otb, NULL, _("Backlight"), o, >>> 1, 0, 1, 0, 0.5, 0.0); >>> >>> >>> >> >> ------------------------------------------------------------------------------ >> >> EditLive Enterprise is the world's most technically advanced content >> authoring tool. Experience the power of Track Changes, Inline Image >> Editing and ensure content is compliant with Accessibility Checking. >> http://p.sf.net/sfu/ephox-dev2dev >> _______________________________________________ >> enlightenment-devel mailing list >> enlightenment-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > > > backlight.patch > > > author : Mathieu Taillefumier (mathieu.taillefum...@free.fr) > > Add automatic backlight dimming. > - two parameters are added : > - sleep backlight is the backlight minimum during extensive inactivity > time (6 min) > - dimming timeout : Time of inactivity after what the backlight is > reduced to the idle backlight intensity > > bin/e_backlight.c | 181 > +++++++++++++++++++++++++++---- > bin/e_config.c | 4 > bin/e_config.h | 3 > modules/conf_display/e_int_config_dpms.c | 39 ++++++ > 4 files changed, 204 insertions(+), 23 deletions(-) > Index: src/bin/e_config.c > =================================================================== > --- src/bin/e_config.c (revision 60455) > +++ src/bin/e_config.c (working copy) > @@ -909,7 +909,9 @@ > E_CONFIG_VAL(D, T, backlight.normal, DOUBLE); > E_CONFIG_VAL(D, T, backlight.dim, DOUBLE); > E_CONFIG_VAL(D, T, backlight.transition, DOUBLE); > - > + E_CONFIG_VAL(D, T, backlight.sleep, DOUBLE); > + E_CONFIG_VAL(D, T, backlight.dimming_timer, DOUBLE); > + E_CONFIG_VAL(D, T, backlight.dimming_enable, INT); > e_config_load(); > > e_config_save_queue(); > Index: src/bin/e_config.h > =================================================================== > --- src/bin/e_config.h (revision 60455) > +++ src/bin/e_config.h (working copy) > @@ -347,7 +347,10 @@ > struct { > double normal; > double dim; > + double sleep; > double transition; > + double dimming_timer; > + Eina_Bool dimming_enable; > } backlight; > }; > > Index: src/bin/e_backlight.c > =================================================================== > --- src/bin/e_backlight.c (revision 60455) > +++ src/bin/e_backlight.c (working copy) > @@ -6,6 +6,7 @@ > > #define MODE_RANDR 0 > #define MODE_SYS 1 > +#define MODE_NONE 2 > > static double bl_val = 1.0; > static double bl_animval = 1.0; > @@ -16,6 +17,9 @@ > static Ecore_Event_Handler *bl_sys_exit_handler = NULL; > static Ecore_Exe *bl_sys_set_exe = NULL; > static Eina_Bool bl_sys_pending_set = EINA_FALSE; > +static Ecore_Poller *_bl_dimming_poll_activity_check = NULL; > +static Eina_Bool _backlight_reduced_level_set = EINA_FALSE; > +static int _bl_log_dom = -1; > > static void _e_backlight_update(E_Zone *zone); > static void _e_backlight_set(E_Zone *zone, double val); > @@ -26,10 +30,42 @@ > static void _bl_sys_level_get(void); > static Eina_Bool _e_bl_cb_exit(void *data __UNUSED__, int type __UNUSED__, > void *event); > static void _bl_sys_level_set(double val); > +static Eina_Bool _bl_poll_activity_check(void *data __UNUSED__); > > +#ifdef ERR > +# undef ERR > +#endif /* ifdef ERR */ > +#define ERR(...) EINA_LOG_DOM_ERR(_bl_log_dom, __VA_ARGS__) > +#ifdef DBG > +# undef DBG > +#endif /* ifdef DBG */ > +#define DBG(...) EINA_LOG_DOM_DBG(_bl_log_dom, __VA_ARGS__) > +#ifdef INF > +# undef INF > +#endif /* ifdef INF */ > +#define INF(...) EINA_LOG_DOM_INFO(_bl_log_dom, __VA_ARGS__) > +#ifdef WRN > +# undef WRN > +#endif /* ifdef WRN */ > +#define WRN(...) EINA_LOG_DOM_WARN(_bl_log_dom, __VA_ARGS__) > +#ifdef CRIT > +# undef CRIT > +#endif /* ifdef CRIT */ > +#define CRIT(...) EINA_LOG_DOM_CRIT(_bl_log_dom, __VA_ARGS__) > + > EINTERN int > e_backlight_init(void) > { > + if (_bl_log_dom< 0) > + { > + _bl_log_dom = eina_log_domain_register("E17 Backlight", > EINA_COLOR_BLUE); > + if(_bl_log_dom< 0) > + { > + EINA_LOG_ERR("Enable to create a log domain for the backlight > extension"); > + return 0; > + } > + } > + > e_backlight_update(); > e_backlight_level_set(NULL, 0.0, 0.0); > e_backlight_level_set(NULL, e_config->backlight.normal, 1.0); > @@ -47,6 +83,13 @@ > bl_sys_exit_handler = NULL; > bl_sys_set_exe = NULL; > bl_sys_pending_set = EINA_FALSE; > + > + if (_bl_dimming_poll_activity_check) > + ecore_poller_del(_bl_dimming_poll_activity_check); > + _bl_dimming_poll_activity_check = NULL; > + > + eina_log_domain_unregister(_bl_log_dom); > + _bl_log_dom = -1; > return 1; > } > > @@ -68,7 +111,27 @@ > } > } > } > + > + /* > + * check if we want to have automatic decrease of the backlight > + * after some amount of time. > + */ > + if (e_config->backlight.dimming_enable) > + { > + if(!_bl_dimming_poll_activity_check) > + { > + _bl_dimming_poll_activity_check = > ecore_poller_add(ECORE_POLLER_CORE , 4, _bl_poll_activity_check, NULL); > } > + } > + else > + { > + if(_bl_dimming_poll_activity_check) > + { > + ecore_poller_del(_bl_dimming_poll_activity_check); > + _bl_dimming_poll_activity_check = NULL; > + } > + } > +} > > EAPI void > e_backlight_level_set(E_Zone *zone, double val, double tim) > @@ -114,17 +177,27 @@ > // zone == NULL == everything > if (bl_mode == mode) return; > bl_mode = mode; > - if (bl_mode == E_BACKLIGHT_MODE_NORMAL) > + switch(bl_mode) > + { > + case E_BACKLIGHT_MODE_NORMAL: > e_backlight_level_set(zone, bl_val, -1.0); > - else if (bl_mode == E_BACKLIGHT_MODE_OFF) > + break; > + case E_BACKLIGHT_MODE_OFF: > e_backlight_level_set(zone, 0.0, -1.0); > - else if (bl_mode == E_BACKLIGHT_MODE_DIM) > - e_backlight_level_set(zone, 0.0, -1.0); > - else if (bl_mode == E_BACKLIGHT_MODE_DIM) > + break; > + case E_BACKLIGHT_MODE_MIN: > + e_backlight_level_set(zone, e_config->backlight.sleep, -1.0); > + break; > + case E_BACKLIGHT_MODE_DIM: > e_backlight_level_set(zone, e_config->backlight.dim, -1.0); > - else if (bl_mode == E_BACKLIGHT_MODE_MAX) > + break; > + case E_BACKLIGHT_MODE_MAX: > e_backlight_level_set(zone, 1.0, -1.0); > + break; > + default: > + break; > } > +} > > EAPI E_Backlight_Mode > e_backlight_mode_get(E_Zone *zone __UNUSED__) > @@ -145,7 +218,7 @@ > > root = zone->container->manager->root; > // try randr > - out = ecore_x_randr_window_outputs_get(root,&num); > + out = ecore_x_randr_outputs_get(root,&num); > if ((out)&& (num> 0)) > x_bl = ecore_x_randr_output_backlight_level_get(root, out[0]); > if (out) free(out); > @@ -168,26 +241,23 @@ > static void > _e_backlight_set(E_Zone *zone, double val) > { > - if (sysmode == MODE_RANDR) > - { > Ecore_X_Window root; > - Ecore_X_Randr_Output *out; > - int num = 0; > > + switch(sysmode) > + { > + case MODE_RANDR: > root = zone->container->manager->root; > - out = ecore_x_randr_window_outputs_get(root,&num); > - if ((out)&& (num> 0)) > - { > - ecore_x_randr_output_backlight_level_set(root, out[0], val); > - } > - if (out) free(out); > - } > - else if (sysmode == MODE_SYS) > - { > + ecore_x_randr_screen_backlight_level_set(root, val); > + break; > + case MODE_SYS: > if (bl_sysval) > { > _bl_sys_level_set(val); > } > + break; > + default: > + WRN("No backlight properties for this screen"); > + break; > } > } > > @@ -348,3 +418,74 @@ > e_prefix_lib_get(), (int)(val * 1000.0)); > bl_sys_set_exe = ecore_exe_run(buf, NULL); > } > + > +static Eina_Bool _bl_poll_activity_check(void *data) > +{ > + Eina_List *list; > + Eina_List *iter; > + Eina_List *m, *c, *z; > + E_Manager *man; > + E_Container *con; > + E_Zone *zone; > + double timer = 0.0; > + E_Backlight_Mode tmp_mode = bl_mode; > + double val = 1.0; > + > + if ((e_config->mode.presentation)&& (bl_mode != E_BACKLIGHT_MODE_NORMAL)) > + { > + tmp_mode = E_BACKLIGHT_MODE_NORMAL; > + /* loop over the outputs */ > + EINA_LIST_FOREACH(e_manager_list(), m, man) > + { > + EINA_LIST_FOREACH(man->containers, c, con) > + { > + EINA_LIST_FOREACH(con->zones, z, zone) > + { > + _e_backlight_set(zone, e_config->backlight.normal); > + } > + } > + } > + bl_mode = E_BACKLIGHT_MODE_NORMAL; > + return EINA_TRUE; > + } > + > + /* read inactivity time */ > + timer = ecore_x_screensaver_idle_time_get(); > + > + if ((timer> e_config->backlight.dimming_timer)&& (bl_mode == > E_BACKLIGHT_MODE_NORMAL)) > + { > + tmp_mode = E_BACKLIGHT_MODE_DIM; > + val = e_config->backlight.dim; > + } > + > + if (timer> 300) > + { > + tmp_mode = E_BACKLIGHT_MODE_MIN; > + val = e_config->backlight.sleep; > + } > + > + if((timer< e_config->backlight.dimming_timer)&&(bl_mode != > E_BACKLIGHT_MODE_NORMAL)) > + { > + tmp_mode = E_BACKLIGHT_MODE_NORMAL; > + val = e_config->backlight.normal; > + } > + > + if (tmp_mode != bl_mode) > + { > + /* loop over the outputs */ > + EINA_LIST_FOREACH(e_manager_list(), m, man) > + { > + EINA_LIST_FOREACH(man->containers, c, con) > + { > + EINA_LIST_FOREACH(con->zones, z, zone) > + { > + _e_backlight_set(zone, val); > + } > + } > + } > + } > + > + bl_mode = tmp_mode; > + > + return EINA_TRUE; > +} > Index: src/modules/conf_display/e_int_config_dpms.c > =================================================================== > --- src/modules/conf_display/e_int_config_dpms.c (revision 60455) > +++ src/modules/conf_display/e_int_config_dpms.c (working copy) > @@ -39,7 +39,10 @@ > > double backlight_normal; > double backlight_dim; > + double backlight_sleep; > double backlight_transition; > + double backlight_dimming_timer; > + Eina_Bool backlight_dimming_enable; > }; > > static E_Dialog *dpms_dialog = NULL; > @@ -65,6 +68,7 @@ > if (dpms_dialog) e_object_del(E_OBJECT(dpms_dialog)); > dpms_dialog = > e_dialog_new(e_container_current_get(e_manager_current_get()), > "E", "_dpms_capable_dialog"); > + > if (!dpms_dialog) return 0; > > e_dialog_title_set(dpms_dialog, _("Display Power Management Signaling")); > @@ -141,7 +145,10 @@ > cfdata->off_timeout = e_config->dpms_off_timeout / 60; > cfdata->backlight_normal = e_config->backlight.normal * 100.0; > cfdata->backlight_dim = e_config->backlight.dim * 100.0; > + cfdata->backlight_sleep = e_config->backlight.sleep * 100.0; > cfdata->backlight_transition = e_config->backlight.transition; > + cfdata->backlight_dimming_timer = e_config->backlight.dimming_timer; > + cfdata->backlight_dimming_enable = e_config->backlight.dimming_enable; > } > > static void > @@ -191,11 +198,24 @@ > > e_config->backlight.normal = cfdata->backlight_normal / 100.0; > e_config->backlight.dim = cfdata->backlight_dim / 100.0; > + e_config->backlight.sleep = cfdata->backlight_sleep / 100.0; > + if(e_config->backlight.dim< e_config->backlight.sleep) > + { > + double tmp = e_config->backlight.dim; > + e_config->backlight.dim = e_config->backlight.sleep; > + e_config->backlight.sleep = tmp; > + } > + > e_config->backlight.transition = cfdata->backlight_transition; > + e_config->backlight.dimming_timer = cfdata->backlight_dimming_timer; > + if (e_config->backlight.dimming_timer> 0.1) > + e_config->backlight.dimming_enable = EINA_TRUE; > + else > + e_config->backlight.dimming_enable = EINA_FALSE; > > e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL); > e_backlight_level_set(NULL, e_config->backlight.normal, -1.0); > - > + e_backlight_update(); > e_config_save_queue(); > e_dpms_update(); > return 1; > @@ -214,7 +234,10 @@ > (e_config->dpms_off_timeout / 60 != cfdata->off_timeout) || > (e_config->backlight.normal * 100.0 != cfdata->backlight_normal) > || > (e_config->backlight.dim * 100.0 != cfdata->backlight_dim) || > - (e_config->backlight.transition != cfdata->backlight_transition); > + (e_config->backlight.transition != cfdata->backlight_transition) || > + (e_config->backlight.sleep != cfdata->backlight_sleep) || > + (e_config->backlight.dimming_timer != > cfdata->backlight_dimming_timer) || > + (e_config->backlight.dimming_enable != > cfdata->backlight_dimming_enable); > } > > static int > @@ -301,12 +324,24 @@ > &(cfdata->backlight_dim), NULL, 100); > e_widget_list_object_append(o, ob, 1, 1, 0.5); > > + ob = e_widget_label_add(evas, _("Sleep Backlight")); > + e_widget_list_object_append(o, ob, 1, 1, 0.5); > + ob = e_widget_slider_add(evas, 1, 0, _("%3.0f"), 0.0, 100.0, 1.0, 0, > +&(cfdata->backlight_sleep), NULL, 100); > + e_widget_list_object_append(o, ob, 1, 1, 0.5); > + > ob = e_widget_label_add(evas, _("Fade Time")); > e_widget_list_object_append(o, ob, 1, 1, 0.5); > ob = e_widget_slider_add(evas, 1, 0, _("%1.1f sec"), 0.0, 5.0, 0.1, 0, > &(cfdata->backlight_transition), NULL, 100); > e_widget_list_object_append(o, ob, 1, 1, 0.5); > > + ob = e_widget_label_add(evas, _("Dimming Time")); > + e_widget_list_object_append(o, ob, 1, 1, 0.5); > + ob = e_widget_slider_add(evas, 1, 0, _("%1.1f sec"), 0.0, 120.0, 0.1, 0, > +&(cfdata->backlight_dimming_timer), NULL, 100); > + e_widget_list_object_append(o, ob, 1, 1, 0.5); > + > e_widget_toolbook_page_append(otb, NULL, _("Backlight"), o, > 1, 0, 1, 0, 0.5, 0.0); > ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel