aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2011-08-21 10:44:23 +0000
committerCarsten Haitzler <raster@rasterman.com>2011-08-21 10:44:23 +0000
commitd88e160f259601c3228b020934cb9b0e8de8d8d9 (patch)
tree1692ce98ebcd8f1c181c44fe72ee24f45e7c097a
parent1bb452f841994a0726a2b9295547c92bdf8284c8 (diff)
downloadenlightenment-d88e160f259601c3228b020934cb9b0e8de8d8d9.tar.gz
enlightenment-d88e160f259601c3228b020934cb9b0e8de8d8d9.tar.xz
enlightenment-d88e160f259601c3228b020934cb9b0e8de8d8d9.zip
as per e17 release todo:
|| LOW || Power || Add suspend/hibernate w/ screen blank or low battery config option || || || || :) SVN revision: 62655
-rw-r--r--config/illume/e.src22
-rw-r--r--config/standard/e.src20
-rw-r--r--src/bin/e_config.c3
-rw-r--r--src/bin/e_config.h45
-rw-r--r--src/bin/e_screensaver.c37
-rw-r--r--src/modules/battery/e_mod_config.c10
-rw-r--r--src/modules/battery/e_mod_main.c11
-rw-r--r--src/modules/battery/e_mod_main.h1
-rw-r--r--src/modules/conf_display/e_int_config_screensaver.c32
9 files changed, 133 insertions, 48 deletions
diff --git a/config/illume/e.src b/config/illume/e.src
index ad36ff11d..a2a0bea2a 100644
--- a/config/illume/e.src
+++ b/config/illume/e.src
@@ -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;
diff --git a/config/standard/e.src b/config/standard/e.src
index 4876d3632..f1db1b5e3 100644
--- a/config/standard/e.src
+++ b/config/standard/e.src
@@ -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;
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index 16af6e7e9..7b5ae5333 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -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);
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index b8a570626..aad490a70 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -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;
diff --git a/src/bin/e_screensaver.c b/src/bin/e_screensaver.c
index b83e5a1ff..02c2b8640 100644
--- a/src/bin/e_screensaver.c
+++ b/src/bin/e_screensaver.c
@@ -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)
{
@@ -159,6 +161,15 @@ _e_screensaver_ask_presentation_mode(void)
}
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;
@@ -166,6 +177,27 @@ _e_screensaver_handler_screensaver_notify_cb(void *data __UNUSED__, int type __U
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();
_e_screensaver_ask_presentation_count = 0;
}
@@ -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);
diff --git a/src/modules/battery/e_mod_config.c b/src/modules/battery/e_mod_config.c
index 0011a6baf..8d6a00fd4 100644
--- a/src/modules/battery/e_mod_config.c
+++ b/src/modules/battery/e_mod_config.c
@@ -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
diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c
index 37f120275..db10e7f29 100644
--- a/src/modules/battery/e_mod_main.c
+++ b/src/modules/battery/e_mod_main.c
@@ -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;
diff --git a/src/modules/battery/e_mod_main.h b/src/modules/battery/e_mod_main.h
index 62e44e59b..a3a51b5dd 100644
--- a/src/modules/battery/e_mod_main.h
+++ b/src/modules/battery/e_mod_main.h
@@ -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;
diff --git a/src/modules/conf_display/e_int_config_screensaver.c b/src/modules/conf_display/e_int_config_screensaver.c
index c97a8bf60..df56cbe24 100644
--- a/src/modules/conf_display/e_int_config_screensaver.c
+++ b/src/modules/conf_display/e_int_config_screensaver.c
@@ -27,6 +27,9 @@ struct _E_Config_Dialog_Data
int exposures;
int ask_presentation;
double ask_presentation_timeout;
+
+ int screensaver_suspend;
+ double screensaver_suspend_delay;
Eina_List *disable_list;
@@ -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,9 +103,10 @@ _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);