forked from enlightenment/enlightenment
as per e17 release todo:
|| LOW || Power || Add suspend/hibernate w/ screen blank or low battery config option || || || || :) SVN revision: 62655
This commit is contained in:
parent
1bb452f841
commit
d88e160f25
|
@ -1597,27 +1597,29 @@ group "E_Config" struct {
|
|||
value "desklock_autolock_idle" int: 0;
|
||||
value "desklock_autolock_idle_timeout" double: 300.0000000000000000000000000;
|
||||
value "desklock_use_custom_desklock" int: 0;
|
||||
value "desklock_ask_presentation" uchar: 1;
|
||||
value "desklock_ask_presentation" uchar: 0;
|
||||
value "desklock_ask_presentation_timeout" double: 30.0000000000000000000000000;
|
||||
value "display_res_restore" int: 0;
|
||||
value "display_res_width" int: 1;
|
||||
value "display_res_height" int: 1;
|
||||
value "display_res_hz" int: 0;
|
||||
value "display_res_rotation" int: 0;
|
||||
value "screensaver_enable" int: 0;
|
||||
value "screensaver_timeout" int: 0;
|
||||
value "screensaver_enable" int: 1;
|
||||
value "screensaver_timeout" int: 60;
|
||||
value "screensaver_interval" int: 5;
|
||||
value "screensaver_blanking" int: 2;
|
||||
value "screensaver_expose" int: 2;
|
||||
value "screensaver_ask_presentation" uchar: 1;
|
||||
value "screensaver_ask_presentation_timeout" double: 30.0000000000000000000000000;
|
||||
value "dpms_enable" int: 0;
|
||||
value "dpms_standby_enable" int: 0;
|
||||
value "dpms_suspend_enable" int: 0;
|
||||
value "dpms_off_enable" int: 0;
|
||||
value "dpms_standby_timeout" int: 1;
|
||||
value "dpms_suspend_timeout" int: 1;
|
||||
value "dpms_off_timeout" int: 1;
|
||||
value "screensaver_suspend" uchar: 1;
|
||||
value "screensaver_suspend_delay" double: 5.0000000000000000000000000;
|
||||
value "dpms_enable" int: 1;
|
||||
value "dpms_standby_enable" int: 1;
|
||||
value "dpms_suspend_enable" int: 1;
|
||||
value "dpms_off_enable" int: 1;
|
||||
value "dpms_standby_timeout" int: 60;
|
||||
value "dpms_suspend_timeout" int: 60;
|
||||
value "dpms_off_timeout" int: 60;
|
||||
value "clientlist_group_by" int: 0;
|
||||
value "clientlist_include_all_zones" int: 0;
|
||||
value "clientlist_separate_with" int: 0;
|
||||
|
|
|
@ -1765,20 +1765,22 @@ group "E_Config" struct {
|
|||
value "display_res_height" int: 1;
|
||||
value "display_res_hz" int: 0;
|
||||
value "display_res_rotation" int: 0;
|
||||
value "screensaver_enable" int: 0;
|
||||
value "screensaver_timeout" int: 0;
|
||||
value "screensaver_enable" int: 1;
|
||||
value "screensaver_timeout" int: 300;
|
||||
value "screensaver_interval" int: 5;
|
||||
value "screensaver_blanking" int: 2;
|
||||
value "screensaver_expose" int: 2;
|
||||
value "screensaver_ask_presentation" uchar: 1;
|
||||
value "screensaver_ask_presentation_timeout" double: 30.0000000000000000000000000;
|
||||
value "dpms_enable" int: 0;
|
||||
value "dpms_standby_enable" int: 0;
|
||||
value "dpms_suspend_enable" int: 0;
|
||||
value "dpms_off_enable" int: 0;
|
||||
value "dpms_standby_timeout" int: 1;
|
||||
value "dpms_suspend_timeout" int: 1;
|
||||
value "dpms_off_timeout" int: 1;
|
||||
value "screensaver_suspend" uchar: 0;
|
||||
value "screensaver_suspend_delay" double: 15.0000000000000000000000000;
|
||||
value "dpms_enable" int: 1;
|
||||
value "dpms_standby_enable" int: 1;
|
||||
value "dpms_suspend_enable" int: 1;
|
||||
value "dpms_off_enable" int: 1;
|
||||
value "dpms_standby_timeout" int: 300;
|
||||
value "dpms_suspend_timeout" int: 300;
|
||||
value "dpms_off_timeout" int: 300;
|
||||
value "clientlist_group_by" int: 0;
|
||||
value "clientlist_include_all_zones" int: 0;
|
||||
value "clientlist_separate_with" int: 0;
|
||||
|
|
|
@ -797,6 +797,9 @@ e_config_init(void)
|
|||
E_CONFIG_VAL(D, T, screensaver_ask_presentation, UCHAR);
|
||||
E_CONFIG_VAL(D, T, screensaver_ask_presentation_timeout, DOUBLE);
|
||||
|
||||
E_CONFIG_VAL(D, T, screensaver_suspend, UCHAR);
|
||||
E_CONFIG_VAL(D, T, screensaver_suspend_delay, DOUBLE);
|
||||
|
||||
E_CONFIG_VAL(D, T, dpms_enable, INT);
|
||||
E_CONFIG_VAL(D, T, dpms_standby_enable, INT);
|
||||
E_CONFIG_VAL(D, T, dpms_suspend_enable, INT);
|
||||
|
|
|
@ -213,16 +213,19 @@ struct _E_Config
|
|||
double desklock_autolock_idle_timeout; // GUI
|
||||
int desklock_use_custom_desklock; // GUI
|
||||
const char *desklock_custom_desklock_cmd; // GUI
|
||||
Eina_Bool desklock_ask_presentation; // GUI
|
||||
double desklock_ask_presentation_timeout; // GUI
|
||||
unsigned char desklock_ask_presentation; // GUI
|
||||
double desklock_ask_presentation_timeout; // GUI
|
||||
|
||||
int screensaver_enable; // GUI
|
||||
int screensaver_timeout; // GUI
|
||||
int screensaver_interval; // GUI
|
||||
int screensaver_blanking; // GUI
|
||||
int screensaver_expose; // GUI
|
||||
Eina_Bool screensaver_ask_presentation; // GUI
|
||||
double screensaver_ask_presentation_timeout; // GUI
|
||||
unsigned char screensaver_ask_presentation; // GUI
|
||||
double screensaver_ask_presentation_timeout; // GUI
|
||||
|
||||
unsigned char screensaver_suspend;
|
||||
double screensaver_suspend_delay;
|
||||
|
||||
int dpms_enable; // GUI
|
||||
int dpms_standby_enable; // GUI
|
||||
|
@ -253,15 +256,15 @@ struct _E_Config
|
|||
int desk_flip_wrap; // GUI
|
||||
int fullscreen_flip; // GUI
|
||||
|
||||
const char *icon_theme; // GUI
|
||||
Eina_Bool icon_theme_overrides; // GUI
|
||||
const char *icon_theme; // GUI
|
||||
unsigned char icon_theme_overrides; // GUI
|
||||
|
||||
int desk_flip_animate_mode; // GUI
|
||||
int desk_flip_animate_interpolation; // GUI
|
||||
double desk_flip_animate_time; // GUI
|
||||
Eina_Bool desk_flip_pan_bg;
|
||||
double desk_flip_pan_x_axis_factor;
|
||||
double desk_flip_pan_y_axis_factor;
|
||||
int desk_flip_animate_mode; // GUI
|
||||
int desk_flip_animate_interpolation; // GUI
|
||||
double desk_flip_animate_time; // GUI
|
||||
unsigned char desk_flip_pan_bg;
|
||||
double desk_flip_pan_x_axis_factor;
|
||||
double desk_flip_pan_y_axis_factor;
|
||||
|
||||
const char *wallpaper_import_last_dev; // INTERNAL
|
||||
const char *wallpaper_import_last_path; // INTERNAL
|
||||
|
@ -322,22 +325,22 @@ struct _E_Config
|
|||
|
||||
struct {
|
||||
struct {
|
||||
int icon_size;
|
||||
int icon_size;
|
||||
} main, secondary, extra;
|
||||
double timeout;
|
||||
unsigned char do_input;
|
||||
Eina_List *actions;
|
||||
double timeout;
|
||||
unsigned char do_input;
|
||||
Eina_List *actions;
|
||||
} syscon;
|
||||
|
||||
struct {
|
||||
Eina_Bool presentation;
|
||||
Eina_Bool offline;
|
||||
unsigned char presentation;
|
||||
unsigned char offline;
|
||||
} mode;
|
||||
|
||||
struct {
|
||||
double expire_timeout;
|
||||
Eina_Bool show_run_dialog;
|
||||
Eina_Bool show_exit_dialog;
|
||||
double expire_timeout;
|
||||
unsigned char show_run_dialog;
|
||||
unsigned char show_exit_dialog;
|
||||
} exec;
|
||||
|
||||
unsigned char null_container_win;
|
||||
|
|
|
@ -17,6 +17,8 @@ static int _e_screensaver_interval = 0;
|
|||
static int _e_screensaver_blanking = 0;
|
||||
static int _e_screensaver_expose = 0;
|
||||
|
||||
static Ecore_Timer *_e_screensaver_suspend_timer = NULL;
|
||||
|
||||
EAPI void
|
||||
e_screensaver_update(void)
|
||||
{
|
||||
|
@ -158,12 +160,42 @@ _e_screensaver_ask_presentation_mode(void)
|
|||
_e_screensaver_ask_presentation_dia = dia;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_screensaver_suspend_cb(void *data __UNUSED__)
|
||||
{
|
||||
_e_screensaver_suspend_timer = NULL;
|
||||
if (e_config->screensaver_suspend)
|
||||
e_sys_action_do(E_SYS_SUSPEND, NULL);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_e_screensaver_handler_screensaver_notify_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_X_Event_Screensaver_Notify *e = event;
|
||||
static double last_start = 0.0;
|
||||
|
||||
if (e->on)
|
||||
{
|
||||
if (_e_screensaver_suspend_timer)
|
||||
{
|
||||
ecore_timer_del(_e_screensaver_suspend_timer);
|
||||
_e_screensaver_suspend_timer = NULL;
|
||||
}
|
||||
if (e_config->screensaver_suspend)
|
||||
_e_screensaver_suspend_timer =
|
||||
ecore_timer_add(e_config->screensaver_suspend_delay,
|
||||
_e_screensaver_suspend_cb, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_e_screensaver_suspend_timer)
|
||||
{
|
||||
ecore_timer_del(_e_screensaver_suspend_timer);
|
||||
_e_screensaver_suspend_timer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (e->on)
|
||||
{
|
||||
last_start = ecore_loop_time_get();
|
||||
|
@ -247,6 +279,11 @@ e_screensaver_init(void)
|
|||
EINTERN int
|
||||
e_screensaver_shutdown(void)
|
||||
{
|
||||
if (_e_screensaver_suspend_timer)
|
||||
{
|
||||
ecore_timer_del(_e_screensaver_suspend_timer);
|
||||
_e_screensaver_suspend_timer = NULL;
|
||||
}
|
||||
if (_e_screensaver_handler_config_mode)
|
||||
{
|
||||
ecore_event_handler_del(_e_screensaver_handler_config_mode);
|
||||
|
|
|
@ -12,6 +12,7 @@ struct _E_Config_Dialog_Data
|
|||
int alert_percent;
|
||||
int dismiss_alert;
|
||||
int alert_timeout;
|
||||
int suspend_below;
|
||||
int force_mode; // 0 == auto, 1 == batget, 2 == subsystem
|
||||
struct
|
||||
{
|
||||
|
@ -71,6 +72,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->alert_percent = battery_config->alert_p;
|
||||
cfdata->poll_interval = battery_config->poll_interval;
|
||||
cfdata->alert_timeout = battery_config->alert_timeout;
|
||||
cfdata->suspend_below = battery_config->suspend_below;
|
||||
cfdata->force_mode = battery_config->force_mode;
|
||||
#ifdef HAVE_EEZE
|
||||
cfdata->fuzzy = battery_config->fuzzy;
|
||||
|
@ -211,6 +213,13 @@ _advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_D
|
|||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f ticks"), 1, 256, 4, 0,
|
||||
NULL, &(cfdata->poll_interval), 100);
|
||||
e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0);
|
||||
|
||||
ob = e_widget_label_add(evas, _("Suspend when below:"));
|
||||
e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f %%"), 0, 50, 1, 0,
|
||||
NULL, &(cfdata->suspend_below), 100);
|
||||
e_widget_table_object_append(o, ob, 0, 3, 1, 1, 1, 0, 1, 0);
|
||||
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Polling"), o, 1, 0, 1, 0,
|
||||
0.5, 0.0);
|
||||
|
||||
|
@ -319,6 +328,7 @@ _advanced_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *c
|
|||
(cfdata->alert_percent != battery_config->alert_p) ||
|
||||
(cfdata->poll_interval != battery_config->poll_interval) ||
|
||||
(cfdata->alert_timeout != battery_config->alert_timeout) ||
|
||||
(cfdata->suspend_below != battery_config->suspend_below) ||
|
||||
#ifdef HAVE_EEZE
|
||||
(cfdata->fuzzy != battery_config->fuzzy) ||
|
||||
#endif
|
||||
|
|
|
@ -561,6 +561,10 @@ _battery_update(int full, int time_left, int time_full, Eina_Bool have_battery,
|
|||
}
|
||||
else if (have_power || ((time_left / 60) > battery_config->alert))
|
||||
_battery_warning_popup_destroy(inst);
|
||||
if ((have_battery) && (!have_power) && (full >= 0) &&
|
||||
(battery_config->suspend_below > 0) &&
|
||||
(full < battery_config->suspend_below))
|
||||
e_sys_action_do(E_SYS_SUSPEND, NULL);
|
||||
}
|
||||
if (!have_battery)
|
||||
e_powersave_mode_set(E_POWERSAVE_MODE_LOW);
|
||||
|
@ -624,9 +628,9 @@ _battery_cb_exe_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
int have_power = 0;
|
||||
|
||||
if (sscanf(ev->lines[i].line, "%i %i %i %i %i", &full, &time_left, &time_full,
|
||||
&have_battery, &have_power) == 5)
|
||||
&have_battery, &have_power) == 5)
|
||||
_battery_update(full, time_left, time_full,
|
||||
have_battery, have_power);
|
||||
have_battery, have_power);
|
||||
else
|
||||
e_powersave_mode_set(E_POWERSAVE_MODE_LOW);
|
||||
}
|
||||
|
@ -666,6 +670,7 @@ e_modapi_init(E_Module *m)
|
|||
E_CONFIG_VAL(D, T, alert, INT);
|
||||
E_CONFIG_VAL(D, T, alert_p, INT);
|
||||
E_CONFIG_VAL(D, T, alert_timeout, INT);
|
||||
E_CONFIG_VAL(D, T, suspend_below, INT);
|
||||
E_CONFIG_VAL(D, T, force_mode, INT);
|
||||
#ifdef HAVE_EEZE
|
||||
E_CONFIG_VAL(D, T, fuzzy, INT);
|
||||
|
@ -679,6 +684,7 @@ e_modapi_init(E_Module *m)
|
|||
battery_config->alert = 30;
|
||||
battery_config->alert_p = 10;
|
||||
battery_config->alert_timeout = 0;
|
||||
battery_config->suspend_below = 0;
|
||||
battery_config->force_mode = 0;
|
||||
#ifdef HAVE_EEZE
|
||||
battery_config->fuzzy = 0;
|
||||
|
@ -688,6 +694,7 @@ e_modapi_init(E_Module *m)
|
|||
E_CONFIG_LIMIT(battery_config->alert, 0, 60);
|
||||
E_CONFIG_LIMIT(battery_config->alert_p, 0, 100);
|
||||
E_CONFIG_LIMIT(battery_config->alert_timeout, 0, 300);
|
||||
E_CONFIG_LIMIT(battery_config->suspend_below, 0, 50);
|
||||
E_CONFIG_LIMIT(battery_config->force_mode, 0, 2);
|
||||
|
||||
battery_config->module = m;
|
||||
|
|
|
@ -28,6 +28,7 @@ struct _Config
|
|||
int alert; /* Alert on minutes remaining */
|
||||
int alert_p; /* Alert on percentage remaining */
|
||||
int alert_timeout; /* Popup dismissal timeout */
|
||||
int suspend_below; /* Suspend if batter drops below this level */
|
||||
int force_mode; /* force use of batget or hal */
|
||||
/* just config state */
|
||||
E_Module *module;
|
||||
|
|
|
@ -28,6 +28,9 @@ struct _E_Config_Dialog_Data
|
|||
int ask_presentation;
|
||||
double ask_presentation_timeout;
|
||||
|
||||
int screensaver_suspend;
|
||||
double screensaver_suspend_delay;
|
||||
|
||||
Eina_List *disable_list;
|
||||
|
||||
struct
|
||||
|
@ -68,8 +71,9 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->blanking = e_config->screensaver_blanking;
|
||||
cfdata->exposures = e_config->screensaver_expose;
|
||||
cfdata->ask_presentation = e_config->screensaver_ask_presentation;
|
||||
cfdata->ask_presentation_timeout =
|
||||
e_config->screensaver_ask_presentation_timeout;
|
||||
cfdata->ask_presentation_timeout = e_config->screensaver_ask_presentation_timeout;
|
||||
cfdata->screensaver_suspend = e_config->screensaver_suspend;
|
||||
cfdata->screensaver_suspend_delay = e_config->screensaver_suspend_delay;
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -99,8 +103,9 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
e_config->screensaver_blanking = cfdata->blanking;
|
||||
e_config->screensaver_expose = cfdata->exposures;
|
||||
e_config->screensaver_ask_presentation = cfdata->ask_presentation;
|
||||
e_config->screensaver_ask_presentation_timeout =
|
||||
cfdata->ask_presentation_timeout;
|
||||
e_config->screensaver_ask_presentation_timeout = cfdata->ask_presentation_timeout;
|
||||
e_config->screensaver_suspend = cfdata->screensaver_suspend;
|
||||
e_config->screensaver_suspend_delay = cfdata->screensaver_suspend_delay;
|
||||
|
||||
/* Apply settings */
|
||||
e_screensaver_update();
|
||||
|
@ -118,7 +123,9 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda
|
|||
(e_config->screensaver_blanking != cfdata->blanking) ||
|
||||
(e_config->screensaver_expose != cfdata->exposures) ||
|
||||
(e_config->screensaver_ask_presentation != cfdata->ask_presentation) ||
|
||||
(e_config->screensaver_ask_presentation_timeout != cfdata->ask_presentation_timeout));
|
||||
(e_config->screensaver_ask_presentation_timeout != cfdata->ask_presentation_timeout) ||
|
||||
(e_config->screensaver_suspend != cfdata->screensaver_suspend) ||
|
||||
(e_config->screensaver_suspend_delay != cfdata->screensaver_suspend_delay));
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
|
@ -135,6 +142,19 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
&(cfdata->enable_screensaver));
|
||||
e_widget_on_change_hook_set(ow, _cb_disable, cfdata);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
|
||||
ow = e_widget_check_add(evas, _("Suspend on blank"),
|
||||
&(cfdata->screensaver_suspend));
|
||||
cfdata->disable_list = eina_list_append(cfdata->disable_list, ow);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
ow = e_widget_label_add(evas, _("Delay until suspend"));
|
||||
cfdata->disable_list = eina_list_append(cfdata->disable_list, ow);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
ow = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"),
|
||||
1.0, 20.0, 1.0, 0, &(cfdata->screensaver_suspend_delay), NULL, 100);
|
||||
cfdata->disable_list = eina_list_append(cfdata->disable_list, ow);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Screensaver"), ol,
|
||||
1, 0, 1, 0, 0.5, 0.0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue