aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2009-04-27 02:54:43 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2009-04-27 02:54:43 +0000
commitddd175a2f2cb043f553758c660c46b6f503bf545 (patch)
treee70709e7b72a85f7b39bc325a4ade497a3286831
parentf7b1ad0f9b5562732d1c1b9f76a6f692adadb294 (diff)
downloadenlightenment-ddd175a2f2cb043f553758c660c46b6f503bf545.tar.gz
enlightenment-ddd175a2f2cb043f553758c660c46b6f503bf545.tar.xz
enlightenment-ddd175a2f2cb043f553758c660c46b6f503bf545.zip
Ask to enter presentation mode.
If you deactivate screensaver (ie: move mouse) or unlock desklock within some given threshold, ask user if he would like to enter presentation mode or even if should increase timeout to next event. This is also useful when at the office and you quickly move mouse in order to keep your explanation. If you know your explanation is short, just hit "increase timeout", otherwise "Yes" to increase timeout. Increase timeout is a multiplier that will increment the factor on each dialog answer. There is an option to stop asking. This can be changed in "Advanced" versions of screensaver and desklock dialogs. SVN revision: 40414
-rw-r--r--config/default/e.src6
-rw-r--r--config/illume/e.src6
-rw-r--r--config/minimalist/e.src6
-rw-r--r--config/netbook/e.src6
-rw-r--r--config/scaleable/e.src6
-rw-r--r--config/standard/e.src6
-rw-r--r--src/bin/e_config.c26
-rw-r--r--src/bin/e_config.h8
-rw-r--r--src/bin/e_desklock.c137
-rw-r--r--src/bin/e_desklock.h1
-rw-r--r--src/bin/e_manager.c4
-rw-r--r--src/bin/e_screensaver.c127
-rw-r--r--src/bin/e_widget_list.c7
-rw-r--r--src/bin/e_widget_list.h3
-rw-r--r--src/modules/conf_desklock/e_int_config_desklock.c54
-rw-r--r--src/modules/conf_screensaver/e_int_config_screensaver.c104
16 files changed, 459 insertions, 48 deletions
diff --git a/config/default/e.src b/config/default/e.src
index 321b0e845..7dc7302bf 100644
--- a/config/default/e.src
+++ b/config/default/e.src
@@ -1,5 +1,5 @@
group "E_Config" struct {
- value "config_version" int: 65841;
+ value "config_version" int: 65842;
value "show_splash" int: 0;
value "init_default_theme" string: "default.edj";
value "desktop_default_name" string: "Desktop %i, %i";
@@ -450,6 +450,8 @@ 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_timeout" double: 30;
value "display_res_restore" int: 0;
value "display_res_width" int: 1;
value "display_res_height" int: 1;
@@ -460,6 +462,8 @@ group "E_Config" struct {
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;
value "dpms_enable" int: 1;
value "dpms_standby_enable" int: 1;
value "dpms_suspend_enable" int: 1;
diff --git a/config/illume/e.src b/config/illume/e.src
index ca90890f0..865ec42d4 100644
--- a/config/illume/e.src
+++ b/config/illume/e.src
@@ -1,5 +1,5 @@
group "E_Config" struct {
- value "config_version" int: 65841;
+ value "config_version" int: 65842;
value "show_splash" int: 1;
value "init_default_theme" string: "default.edj";
value "desktop_default_name" string: "Desktop %i, %i";
@@ -660,6 +660,8 @@ 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_timeout" double: 30;
value "display_res_restore" int: 0;
value "display_res_width" int: 1;
value "display_res_height" int: 1;
@@ -670,6 +672,8 @@ group "E_Config" struct {
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;
value "dpms_enable" int: 0;
value "dpms_standby_enable" int: 0;
value "dpms_suspend_enable" int: 0;
diff --git a/config/minimalist/e.src b/config/minimalist/e.src
index 94a4e62a7..a4dfa7da2 100644
--- a/config/minimalist/e.src
+++ b/config/minimalist/e.src
@@ -1,5 +1,5 @@
group "E_Config" struct {
- value "config_version" int: 65841;
+ value "config_version" int: 65842;
value "show_splash" int: 1;
value "init_default_theme" string: "default.edj";
value "desktop_default_background" string: "Light_Gradient.edj";
@@ -1864,6 +1864,8 @@ 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_timeout" double: 30;
value "display_res_restore" int: 0;
value "display_res_width" int: 1;
value "display_res_height" int: 1;
@@ -1874,6 +1876,8 @@ group "E_Config" struct {
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;
value "dpms_enable" int: 0;
value "dpms_standby_enable" int: 0;
value "dpms_suspend_enable" int: 0;
diff --git a/config/netbook/e.src b/config/netbook/e.src
index 230f3947b..0675c41ba 100644
--- a/config/netbook/e.src
+++ b/config/netbook/e.src
@@ -1,5 +1,5 @@
group "E_Config" struct {
- value "config_version" int: 65841;
+ value "config_version" int: 65842;
value "show_splash" int: 1;
value "init_default_theme" string: "default.edj";
value "desktop_default_background" string: "Dark_Gradient.edj";
@@ -1928,6 +1928,8 @@ 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_timeout" double: 30;
value "display_res_restore" int: 0;
value "display_res_width" int: 1;
value "display_res_height" int: 1;
@@ -1938,6 +1940,8 @@ group "E_Config" struct {
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;
value "dpms_enable" int: 0;
value "dpms_standby_enable" int: 0;
value "dpms_suspend_enable" int: 0;
diff --git a/config/scaleable/e.src b/config/scaleable/e.src
index 1e718aa13..d865acdef 100644
--- a/config/scaleable/e.src
+++ b/config/scaleable/e.src
@@ -1,5 +1,5 @@
group "E_Config" struct {
- value "config_version" int: 65841;
+ value "config_version" int: 65842;
value "show_splash" int: 1;
value "init_default_theme" string: "default.edj";
value "desktop_default_name" string: "Desktop %i, %i";
@@ -1951,6 +1951,8 @@ 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_timeout" double: 30;
value "display_res_restore" int: 0;
value "display_res_width" int: 1;
value "display_res_height" int: 1;
@@ -1961,6 +1963,8 @@ group "E_Config" struct {
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;
value "dpms_enable" int: 0;
value "dpms_standby_enable" int: 0;
value "dpms_suspend_enable" int: 0;
diff --git a/config/standard/e.src b/config/standard/e.src
index 611a36a24..6a98183d5 100644
--- a/config/standard/e.src
+++ b/config/standard/e.src
@@ -1,5 +1,5 @@
group "E_Config" struct {
- value "config_version" int: 65841;
+ value "config_version" int: 65842;
value "show_splash" int: 1;
value "init_default_theme" string: "default.edj";
value "desktop_default_name" string: "Desktop %i, %i";
@@ -1961,6 +1961,8 @@ 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_timeout" double: 30;
value "display_res_restore" int: 0;
value "display_res_width" int: 1;
value "display_res_height" int: 1;
@@ -1971,6 +1973,8 @@ group "E_Config" struct {
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;
value "dpms_enable" int: 0;
value "dpms_standby_enable" int: 0;
value "dpms_suspend_enable" int: 0;
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index a02d1228a..d8b87848d 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -572,6 +572,9 @@ e_config_init(void)
E_CONFIG_VAL(D, T, desklock_autolock_idle_timeout, DOUBLE);
E_CONFIG_VAL(D, T, desklock_use_custom_desklock, INT);
E_CONFIG_VAL(D, T, desklock_custom_desklock_cmd, STR);
+ E_CONFIG_VAL(D, T, desklock_ask_presentation, UCHAR);
+ E_CONFIG_VAL(D, T, desklock_ask_presentation_timeout, DOUBLE);
+
E_CONFIG_VAL(D, T, display_res_restore, INT);
E_CONFIG_VAL(D, T, display_res_width, INT);
E_CONFIG_VAL(D, T, display_res_height, INT);
@@ -583,7 +586,9 @@ e_config_init(void)
E_CONFIG_VAL(D, T, screensaver_interval, INT);
E_CONFIG_VAL(D, T, screensaver_blanking, INT);
E_CONFIG_VAL(D, T, screensaver_expose, INT);
-
+ E_CONFIG_VAL(D, T, screensaver_ask_presentation, UCHAR);
+ E_CONFIG_VAL(D, T, screensaver_ask_presentation_timeout, 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);
@@ -815,6 +820,7 @@ e_config_load(void)
}
}
#define IFCFG(v) if ((e_config->config_version & 0xffff) < (v)) {
+#define IFCFGELSE } else {
#define IFCFGEND }
#define COPYVAL(x) do {e_config->x = tcfg->x;} while (0)
#define COPYPTR(x) do {e_config->x = tcfg->x; tcfg->x = NULL;} while (0)
@@ -897,6 +903,18 @@ e_config_load(void)
COPYVAL(desklock_post_screensaver_time);
IFCFGEND;
+ IFCFG(0x0132);
+ COPYVAL(desklock_ask_presentation);
+ COPYVAL(desklock_ask_presentation_timeout);
+ COPYVAL(screensaver_ask_presentation);
+ COPYVAL(screensaver_ask_presentation_timeout);
+ IFCFGELSE;
+ e_config->desklock_ask_presentation = 1;
+ e_config->desklock_ask_presentation_timeout = 30.0;
+ e_config->screensaver_ask_presentation = 1;
+ e_config->screensaver_ask_presentation_timeout = 30.0;
+ IFCFGEND;
+
e_config->config_version = E_CONFIG_FILE_VERSION;
_e_config_free(tcfg);
}
@@ -987,6 +1005,8 @@ e_config_load(void)
E_CONFIG_LIMIT(e_config->desklock_autolock_idle, 0, 1);
E_CONFIG_LIMIT(e_config->desklock_autolock_idle_timeout, 1.0, 5400.0);
E_CONFIG_LIMIT(e_config->desklock_use_custom_desklock, 0, 1);
+ E_CONFIG_LIMIT(e_config->desklock_ask_presentation, 0, 1);
+ E_CONFIG_LIMIT(e_config->desklock_ask_presentation_timeout, 1.0, 300.0);
E_CONFIG_LIMIT(e_config->display_res_restore, 0, 1);
E_CONFIG_LIMIT(e_config->display_res_width, 1, 8192);
E_CONFIG_LIMIT(e_config->display_res_height, 1, 8192);
@@ -1012,7 +1032,9 @@ e_config_load(void)
E_CONFIG_LIMIT(e_config->screensaver_interval, 0, 5400);
E_CONFIG_LIMIT(e_config->screensaver_blanking, 0, 2);
E_CONFIG_LIMIT(e_config->screensaver_expose, 0, 2);
-
+ E_CONFIG_LIMIT(e_config->screensaver_ask_presentation, 0, 1);
+ E_CONFIG_LIMIT(e_config->screensaver_ask_presentation_timeout, 1.0, 300.0);
+
E_CONFIG_LIMIT(e_config->clientlist_group_by, 0, 2);
E_CONFIG_LIMIT(e_config->clientlist_include_all_zones, 0, 1);
E_CONFIG_LIMIT(e_config->clientlist_separate_with, 0, 2);
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index 3716018fd..b7711419f 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -35,7 +35,7 @@ typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme;
/* increment this whenever a new set of config values are added but the users
* config doesn't need to be wiped - simply new values need to be put in
*/
-#define E_CONFIG_FILE_GENERATION 0x0131
+#define E_CONFIG_FILE_GENERATION 0x0132
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
#define E_EVAS_ENGINE_DEFAULT 0
@@ -223,12 +223,16 @@ 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
+
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
int dpms_enable; // GUI
int dpms_standby_enable; // GUI
diff --git a/src/bin/e_desklock.c b/src/bin/e_desklock.c
index 06dbc6b12..7b65bc6c7 100644
--- a/src/bin/e_desklock.c
+++ b/src/bin/e_desklock.c
@@ -61,6 +61,9 @@ static Ecore_Exe *_e_custom_desklock_exe = NULL;
static Ecore_Event_Handler *_e_custom_desklock_exe_handler = NULL;
static Ecore_Poller *_e_desklock_idle_poller = NULL;
static int _e_desklock_user_idle = 0;
+static double _e_desklock_autolock_time = 0.0;
+static E_Dialog *_e_desklock_ask_presentation_dia = NULL;
+static int _e_desklock_ask_presentation_count = 0;
/***********************************************************************/
@@ -89,6 +92,8 @@ static char *_desklock_auth_get_current_user(void);
static char *_desklock_auth_get_current_host(void);
#endif
+static void _e_desklock_ask_presentation_mode(void);
+
EAPI int E_EVENT_DESKLOCK = 0;
EAPI int
@@ -134,6 +139,13 @@ _user_wallpaper_get(void)
}
EAPI int
+e_desklock_show_autolocked(void)
+{
+ _e_desklock_autolock_time = ecore_loop_time_get();
+ return e_desklock_show();
+}
+
+EAPI int
e_desklock_show(void)
{
Eina_List *managers, *l, *l2, *l3;
@@ -434,6 +446,24 @@ e_desklock_hide(void)
ev = E_NEW(E_Event_Desklock, 1);
ev->on = 0;
ecore_event_add(E_EVENT_DESKLOCK, ev, NULL, NULL);
+
+ if (_e_desklock_autolock_time > 0.0)
+ {
+ if ((e_config->desklock_ask_presentation) &&
+ (e_config->desklock_ask_presentation_timeout > 0.0))
+ {
+ double max, now;
+
+ now = ecore_loop_time_get();
+ max = _e_desklock_autolock_time + e_config->desklock_ask_presentation_timeout;
+ if (now <= max)
+ _e_desklock_ask_presentation_mode();
+ }
+ else
+ _e_desklock_ask_presentation_count = 0;
+
+ _e_desklock_autolock_time = 0.0;
+ }
}
static int
@@ -889,11 +919,18 @@ _e_desklock_cb_idle_poller(void *data)
{
if ((e_config->desklock_autolock_idle) && (!e_config->mode.presentation))
{
+ double idle, max;
+
/* If a desklock is already up, bail */
if ((_e_custom_desklock_exe) || (edd)) return 1;
+ idle = ecore_x_screensaver_idle_time_get();
+ max = e_config->desklock_autolock_idle_timeout;
+ if (_e_desklock_ask_presentation_count > 0)
+ max *= _e_desklock_ask_presentation_count;
+
/* If we have exceeded our idle time... */
- if (ecore_x_screensaver_idle_time_get() >= e_config->desklock_autolock_idle_timeout)
+ if (idle >= max)
{
/*
* Unfortunately, not all "desklocks" stay up for as long as
@@ -907,7 +944,7 @@ _e_desklock_cb_idle_poller(void *data)
if (!_e_desklock_user_idle)
{
_e_desklock_user_idle = 1;
- e_desklock_show();
+ e_desklock_show_autolocked();
}
}
else
@@ -917,3 +954,99 @@ _e_desklock_cb_idle_poller(void *data)
/* Make sure our poller persists. */
return 1;
}
+
+static void
+_e_desklock_ask_presentation_del(void *data)
+{
+ if (_e_desklock_ask_presentation_dia == data)
+ _e_desklock_ask_presentation_dia = NULL;
+}
+
+static void
+_e_desklock_ask_presentation_yes(void *data __UNUSED__, E_Dialog *dia)
+{
+ e_config->mode.presentation = 1;
+ e_config_mode_changed();
+ e_config_save_queue();
+ e_object_del(E_OBJECT(dia));
+ _e_desklock_ask_presentation_count = 0;
+}
+
+static void
+_e_desklock_ask_presentation_no(void *data __UNUSED__, E_Dialog *dia)
+{
+ e_object_del(E_OBJECT(dia));
+ _e_desklock_ask_presentation_count = 0;
+}
+
+static void
+_e_desklock_ask_presentation_no_increase(void *data __UNUSED__, E_Dialog *dia)
+{
+ int timeout, interval, blanking, expose;
+
+ _e_desklock_ask_presentation_count++;
+ timeout = e_config->screensaver_timeout * _e_desklock_ask_presentation_count;
+ interval = e_config->screensaver_interval;
+ blanking = e_config->screensaver_blanking;
+ expose = e_config->screensaver_expose;
+
+ ecore_x_screensaver_set(timeout, interval, blanking, expose);
+ e_object_del(E_OBJECT(dia));
+}
+
+static void
+_e_desklock_ask_presentation_no_forever(void *data __UNUSED__, E_Dialog *dia)
+{
+ e_config->desklock_ask_presentation = 0;
+ e_config_save_queue();
+ e_object_del(E_OBJECT(dia));
+ _e_desklock_ask_presentation_count = 0;
+}
+
+static void
+_e_desklock_ask_presentation_mode(void)
+{
+ E_Manager *man;
+ E_Container *con;
+ E_Dialog *dia;
+
+ if (_e_desklock_ask_presentation_dia)
+ return;
+
+ man = e_manager_current_get();
+ if (!man) return;
+ con = e_container_current_get(man);
+ if (!con) return;
+ dia = e_dialog_new(con, "E", "_desklock_ask_presentation");
+ if (!dia) return;
+
+ e_dialog_title_set(dia, _("Activate Presentation Mode?"));
+ e_dialog_icon_set(dia, "dialog-ask", 64);
+ e_dialog_text_set
+ (dia,
+ _("You unlocked desktop too fast.<br><br>"
+ "Would you like to enabe <b>presentation</b> mode and "
+ "temporarily disable screen saver, lock and power saving?"));
+
+ e_object_del_attach_func_set
+ (E_OBJECT(dia), _e_desklock_ask_presentation_del);
+ e_dialog_button_add
+ (dia, _("Yes"), NULL, _e_desklock_ask_presentation_yes, NULL);
+ e_dialog_button_add
+ (dia, _("No"), NULL, _e_desklock_ask_presentation_no, NULL);
+ e_dialog_button_add
+ (dia, _("No, but increase timeout"), NULL,
+ _e_desklock_ask_presentation_no_increase, NULL);
+ e_dialog_button_add
+ (dia, _("No, and stop asking"), NULL,
+ _e_desklock_ask_presentation_no_forever, NULL);
+
+ e_dialog_button_focus_num(dia, 0);
+ e_dialog_resizable_set(dia, 1);
+ e_widget_list_homogeneous_set(dia->box_object, 0);
+ e_util_win_auto_resize_fill(dia->win);
+ e_win_centered_set(dia->win, 1);
+ e_dialog_show(dia);
+
+ _e_desklock_ask_presentation_dia = dia;
+}
diff --git a/src/bin/e_desklock.h b/src/bin/e_desklock.h
index d5bc32758..11ee6a045 100644
--- a/src/bin/e_desklock.h
+++ b/src/bin/e_desklock.h
@@ -15,6 +15,7 @@ EAPI int e_desklock_init(void);
EAPI int e_desklock_shutdown(void);
EAPI int e_desklock_show(void);
+EAPI int e_desklock_show_autolocked(void);
EAPI void e_desklock_hide(void);
extern EAPI int E_EVENT_DESKLOCK;
diff --git a/src/bin/e_manager.c b/src/bin/e_manager.c
index 26fdebe34..9b57fd98d 100644
--- a/src/bin/e_manager.c
+++ b/src/bin/e_manager.c
@@ -795,7 +795,7 @@ _e_manager_cb_ping(void *data, int ev_type __UNUSED__, void *ev)
static int
_e_manager_cb_timer_post_screensaver_lock(void *data __UNUSED__)
{
- e_desklock_show();
+ e_desklock_show_autolocked();
timer_post_screensaver_lock = NULL;
return 0;
}
@@ -817,7 +817,7 @@ _e_manager_cb_screensaver_notify(void *data __UNUSED__, int ev_type __UNUSED__,
{
if (e_config->desklock_post_screensaver_time <= 1.0)
{
- e_desklock_show();
+ e_desklock_show_autolocked();
}
else
{
diff --git a/src/bin/e_screensaver.c b/src/bin/e_screensaver.c
index 6ed2b0820..54d4a6339 100644
--- a/src/bin/e_screensaver.c
+++ b/src/bin/e_screensaver.c
@@ -4,6 +4,9 @@
#include "e.h"
static Ecore_Event_Handler *_e_screensaver_handler_config_mode = NULL;
+static Ecore_Event_Handler *_e_screensaver_handler_screensaver_notify = NULL;
+static E_Dialog *_e_screensaver_ask_presentation_dia = NULL;
+static int _e_screensaver_ask_presentation_count = 0;
static int
_e_screensaver_handler_config_mode_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
@@ -12,6 +15,126 @@ _e_screensaver_handler_config_mode_cb(void *data __UNUSED__, int type __UNUSED__
return 1;
}
+static void
+_e_screensaver_ask_presentation_del(void *data)
+{
+ if (_e_screensaver_ask_presentation_dia == data)
+ _e_screensaver_ask_presentation_dia = NULL;
+}
+
+static void
+_e_screensaver_ask_presentation_yes(void *data __UNUSED__, E_Dialog *dia)
+{
+ e_config->mode.presentation = 1;
+ e_config_mode_changed();
+ e_config_save_queue();
+ e_object_del(E_OBJECT(dia));
+ _e_screensaver_ask_presentation_count = 0;
+}
+
+static void
+_e_screensaver_ask_presentation_no(void *data __UNUSED__, E_Dialog *dia)
+{
+ e_object_del(E_OBJECT(dia));
+ _e_screensaver_ask_presentation_count = 0;
+}
+
+static void
+_e_screensaver_ask_presentation_no_increase(void *data __UNUSED__, E_Dialog *dia)
+{
+ int timeout, interval, blanking, expose;
+
+ _e_screensaver_ask_presentation_count++;
+ timeout = e_config->screensaver_timeout * _e_screensaver_ask_presentation_count;
+ interval = e_config->screensaver_interval;
+ blanking = e_config->screensaver_blanking;
+ expose = e_config->screensaver_expose;
+
+ ecore_x_screensaver_set(timeout, interval, blanking, expose);
+ e_object_del(E_OBJECT(dia));
+}
+
+static void
+_e_screensaver_ask_presentation_no_forever(void *data __UNUSED__, E_Dialog *dia)
+{
+ e_config->screensaver_ask_presentation = 0;
+ e_config_save_queue();
+ e_object_del(E_OBJECT(dia));
+ _e_screensaver_ask_presentation_count = 0;
+}
+
+static void
+_e_screensaver_ask_presentation_mode(void)
+{
+ E_Manager *man;
+ E_Container *con;
+ E_Dialog *dia;
+
+ if (_e_screensaver_ask_presentation_dia)
+ return;
+
+ man = e_manager_current_get();
+ if (!man) return;
+ con = e_container_current_get(man);
+ if (!con) return;
+ dia = e_dialog_new(con, "E", "_screensaver_ask_presentation");
+ if (!dia) return;
+
+ e_dialog_title_set(dia, _("Activate Presentation Mode?"));
+ e_dialog_icon_set(dia, "dialog-ask", 64);
+ e_dialog_text_set
+ (dia,
+ _("You disabled screensaver too fast.<br><br>"
+ "Would you like to enabe <b>presentation</b> mode and "
+ "temporarily disable screen saver, lock and power saving?"));
+
+ e_object_del_attach_func_set
+ (E_OBJECT(dia), _e_screensaver_ask_presentation_del);
+ e_dialog_button_add
+ (dia, _("Yes"), NULL, _e_screensaver_ask_presentation_yes, NULL);
+ e_dialog_button_add
+ (dia, _("No"), NULL, _e_screensaver_ask_presentation_no, NULL);
+ e_dialog_button_add
+ (dia, _("No, but increase timeout"), NULL,
+ _e_screensaver_ask_presentation_no_increase, NULL);
+ e_dialog_button_add
+ (dia, _("No, and stop asking"), NULL,
+ _e_screensaver_ask_presentation_no_forever, NULL);
+
+ e_dialog_button_focus_num(dia, 0);
+ e_dialog_resizable_set(dia, 1);
+ e_widget_list_homogeneous_set(dia->box_object, 0);
+ e_util_win_auto_resize_fill(dia->win);
+ e_win_centered_set(dia->win, 1);
+ e_dialog_show(dia);
+
+ _e_screensaver_ask_presentation_dia = dia;
+}
+
+static int
+_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)
+ {
+ last_start = ecore_loop_time_get();
+ _e_screensaver_ask_presentation_count = 0;
+ }
+ else if ((last_start > 0.0) && (e_config->screensaver_ask_presentation))
+ {
+ double current = ecore_loop_time_get();
+ if (last_start + e_config->screensaver_ask_presentation_timeout >= current)
+ _e_screensaver_ask_presentation_mode();
+ last_start = 0.0;
+ }
+ else if (_e_screensaver_ask_presentation_count)
+ _e_screensaver_ask_presentation_count = 0;
+
+ return 1;
+}
+
EAPI int
e_screensaver_init(void)
{
@@ -21,6 +144,10 @@ e_screensaver_init(void)
_e_screensaver_handler_config_mode = ecore_event_handler_add
(E_EVENT_CONFIG_MODE_CHANGED, _e_screensaver_handler_config_mode_cb, NULL);
+ if (!_e_screensaver_handler_screensaver_notify)
+ _e_screensaver_handler_screensaver_notify = ecore_event_handler_add
+ (ECORE_X_EVENT_SCREENSAVER_NOTIFY, _e_screensaver_handler_screensaver_notify_cb, NULL);
+
if ((e_config->screensaver_enable) && (!e_config->mode.presentation))
timeout = e_config->screensaver_timeout;
diff --git a/src/bin/e_widget_list.c b/src/bin/e_widget_list.c
index 08700abc2..5e93f010b 100644
--- a/src/bin/e_widget_list.c
+++ b/src/bin/e_widget_list.c
@@ -70,6 +70,13 @@ e_widget_list_object_append(Evas_Object *obj, Evas_Object *sobj, int fill, int e
evas_object_show(sobj);
}
+EAPI void
+e_widget_list_homogeneous_set(Evas_Object *obj, int homogenous)
+{
+ E_Widget_Data *wd = e_widget_data_get(obj);
+ e_box_homogenous_set(wd->o_box, homogenous);
+}
+
static void
_e_wid_del_hook(Evas_Object *obj)
{
diff --git a/src/bin/e_widget_list.h b/src/bin/e_widget_list.h
index 29eb0b8d0..f30c4da79 100644
--- a/src/bin/e_widget_list.h
+++ b/src/bin/e_widget_list.h
@@ -8,7 +8,8 @@
EAPI Evas_Object *e_widget_list_add(Evas *evas, int homogenous, int horiz);
EAPI void e_widget_list_object_append(Evas_Object *obj, Evas_Object *sobj, int fill, int expand, double align);
-
+EAPI void e_widget_list_homogeneous_set(Evas_Object *obj, int homogenous);
+
#endif
#endif
diff --git a/src/modules/conf_desklock/e_int_config_desklock.c b/src/modules/conf_desklock/e_int_config_desklock.c
index 4681c6797..b564e860a 100644
--- a/src/modules/conf_desklock/e_int_config_desklock.c
+++ b/src/modules/conf_desklock/e_int_config_desklock.c
@@ -26,6 +26,8 @@ static int _zone_count_get(void);
static void _cb_disable_check(void *data, Evas_Object *obj);
+static void _cb_ask_presentation_changed(void *data, Evas_Object *obj);
+
struct _E_Config_Dialog_Data
{
E_Config_Dialog *cfd;
@@ -53,6 +55,8 @@ struct _E_Config_Dialog_Data
char *custom_lock_cmd;
int login_zone;
int zone;
+ int ask_presentation;
+ double ask_presentation_timeout;
struct {
struct {
@@ -61,6 +65,10 @@ struct _E_Config_Dialog_Data
Evas_Object *post_screensaver_label;
Evas_Object *post_screensaver_slider;
} basic;
+ struct {
+ Evas_Object *ask_presentation_label;
+ Evas_Object *ask_presentation_slider;
+ } adv;
} gui;
};
@@ -135,6 +143,9 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->login_zone = e_config->desklock_login_box_zone;
cfdata->zone = 0;
}
+
+ cfdata->ask_presentation = e_config->desklock_ask_presentation;
+ cfdata->ask_presentation_timeout = e_config->desklock_ask_presentation_timeout;
}
static void *
@@ -422,8 +433,30 @@ _adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
1, 0, 1, 0);
e_widget_table_object_append(mt, of, 1, 1, 1, 1, 1, 1, 1, 1);
+
+ of = e_widget_framelist_add(evas, _("Enter Presentation Mode"), 0);
+
+ ow = e_widget_check_add(evas, _("Suggest entering presentation mode"), &(cfdata->ask_presentation));
+ e_widget_on_change_hook_set(ow, _cb_ask_presentation_changed, cfdata);
+ e_widget_framelist_object_append(of, ow);
+
+ ow = e_widget_label_add(evas, _("If deactivated before"));
+ cfdata->gui.adv.ask_presentation_label = ow;
+ e_widget_framelist_object_append(of, ow);
+
+ ow = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"),
+ 1.0, 300.0, 10.0, 0,
+ &(cfdata->ask_presentation_timeout), NULL, 100);
+ cfdata->gui.adv.ask_presentation_slider = ow;
+ e_widget_framelist_object_append(of, ow);
+
+ _cb_ask_presentation_changed(cfdata, NULL);
+
+ e_widget_table_object_append(mt, of, 1, 2, 1, 1, 1, 1, 1, 1);
+
+
ow = _basic_create(cfd, evas, cfdata);
- e_widget_table_object_append(mt, ow, 2, 1, 1, 1, 1, 1, 1, 1);
+ e_widget_table_object_append(mt, ow, 2, 1, 1, 2, 1, 1, 1, 1);
of = e_widget_framelist_add(evas, _("Custom Screenlock"), 0);
custom_screenlock_check = e_widget_check_add(evas, _("Use custom screenlock"),
@@ -432,7 +465,7 @@ _adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
ow = e_widget_entry_add(evas, &(cfdata->custom_lock_cmd), NULL, NULL, NULL);
e_widget_disabled_set(ow, !cfdata->custom_lock); // set state from saved config
e_widget_framelist_object_append(of, ow);
- e_widget_table_object_append(mt, of, 1, 2, 2, 1, 1, 1, 1, 1);
+ e_widget_table_object_append(mt, of, 1, 3, 2, 1, 1, 1, 1, 1);
// handler for enable/disable widget array
e_widget_on_change_hook_set(custom_screenlock_check, _cb_disable_check, ow);
@@ -447,6 +480,8 @@ _adv_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_config->desklock_autolock_idle = cfdata->auto_lock;
e_config->desklock_autolock_screensaver = cfdata->screensaver_lock;
e_config->desklock_autolock_idle_timeout = cfdata->idle_time * 60;
+ e_config->desklock_ask_presentation = cfdata->ask_presentation;
+ e_config->desklock_ask_presentation_timeout = cfdata->ask_presentation_timeout;
if (cfdata->bg)
{
@@ -515,7 +550,8 @@ _adv_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
else if (e_config->desklock_custom_desklock_cmd != cfdata->custom_lock_cmd)
return 1;
- return 0;
+ return ((e_config->desklock_ask_presentation != cfdata->ask_presentation) ||
+ (e_config->desklock_ask_presentation_timeout != cfdata->ask_presentation_timeout));
}
static void
@@ -727,3 +763,15 @@ _cb_disable_check(void *data, Evas_Object *obj)
e_widget_disabled_set((Evas_Object *) data,
!e_widget_check_checked_get(obj));
}
+
+static void
+_cb_ask_presentation_changed(void *data, Evas_Object *obj __UNUSED__)
+{
+ E_Config_Dialog_Data *cfdata = data;
+ Eina_Bool disable;
+
+ disable = (!cfdata->ask_presentation);
+
+ e_widget_disabled_set(cfdata->gui.adv.ask_presentation_label, disable);
+ e_widget_disabled_set(cfdata->gui.adv.ask_presentation_slider, disable);
+}
diff --git a/src/modules/conf_screensaver/e_int_config_screensaver.c b/src/modules/conf_screensaver/e_int_config_screensaver.c
index 1d4c46730..946720e6d 100644
--- a/src/modules/conf_screensaver/e_int_config_screensaver.c
+++ b/src/modules/conf_screensaver/e_int_config_screensaver.c
@@ -16,8 +16,9 @@ static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas,
E_Config_Dialog_Data *cfdata);
-static void _cb_disable_check(void *data, Evas_Object *obj);
-static void _cb_disable_check_list(void *data, Evas_Object *obj);
+static void _cb_disable_basic(void *data, Evas_Object *obj);
+static void _cb_disable_adv(void *data, Evas_Object *obj);
+static void _cb_ask_presentation_changed(void *data, Evas_Object *obj);
struct _E_Config_Dialog_Data
{
@@ -28,8 +29,21 @@ struct _E_Config_Dialog_Data
double interval;
int blanking;
int exposures;
+ int ask_presentation;
+ double ask_presentation_timeout;
Eina_List *disable_list;
+
+ struct {
+ struct {
+ Evas_Object *label;
+ Evas_Object *slider;
+ } basic;
+ struct {
+ Evas_Object *ask_presentation_label;
+ Evas_Object *ask_presentation_slider;
+ } adv;
+ } gui;
};
EAPI E_Config_Dialog *
@@ -64,6 +78,8 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->interval = e_config->screensaver_interval;
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;
}
static void *
@@ -92,6 +108,8 @@ _apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_config->screensaver_interval = cfdata->interval;
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;
/* Apply settings */
e_screensaver_init();
@@ -120,14 +138,15 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
of = e_widget_framelist_add(evas, _("Screensaver Timer(s)"), 0);
ob = e_widget_label_add(evas, _("Time until X screensaver starts"));
+ cfdata->gui.basic.label = ob;
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"), 1.0, 90.0, 1.0, 0,
&(cfdata->timeout), NULL, 100);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
+ cfdata->gui.basic.slider = ob;
e_widget_framelist_object_append(of, ob);
- // handler for enable/disable widget
- e_widget_on_change_hook_set(xscreensaver_check, _cb_disable_check, ob);
+ e_widget_on_change_hook_set(xscreensaver_check, _cb_disable_basic, cfdata);
+ _cb_disable_basic(cfdata, NULL);
e_widget_list_object_append(o, of, 1, 1, 0.5);
return o;
@@ -157,34 +176,52 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
of = e_widget_framelist_add(evas, _("Screensaver Timer(s)"), 0);
ob = e_widget_label_add(evas, _("Time until X screensaver starts"));
+ cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"),
1.0, 90.0, 1.0, 0, &(cfdata->timeout), NULL, 200);
cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Time until X screensaver alternates"));
+ cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"),
1.0, 300.0, 1.0, 0, &(cfdata->interval), NULL, 200);
cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
+ of = e_widget_framelist_add(evas, _("Enter Presentation Mode"), 0);
+
+ ob = e_widget_check_add(evas, _("Suggest entering presentation mode"), &(cfdata->ask_presentation));
+ e_widget_on_change_hook_set(ob, _cb_ask_presentation_changed, cfdata);
+ cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
+ e_widget_framelist_object_append(of, ob);
+
+ ob = e_widget_label_add(evas, _("If deactivated before"));
+ cfdata->gui.adv.ask_presentation_label = ob;
+ cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
+ e_widget_framelist_object_append(of, ob);
+
+ ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"),
+ 1.0, 300.0, 10.0, 0,
+ &(cfdata->ask_presentation_timeout), NULL, 200);
+ cfdata->gui.adv.ask_presentation_slider = ob;
+ cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
+ e_widget_framelist_object_append(of, ob);
+
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+
of = e_widget_framelist_add(evas, _("Blanking"), 0);
rg = e_widget_radio_group_new(&(cfdata->blanking));
ob = e_widget_radio_add(evas, _("Default"), E_CONFIG_BLANKING_DEFAULT, rg);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Preferred"), E_CONFIG_BLANKING_PREFERRED, rg);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Not Preferred"), E_CONFIG_BLANKING_NOT_PREFERRED, rg);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
@@ -192,47 +229,54 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
of = e_widget_framelist_add(evas, _("Exposure Events"), 0);
rg = e_widget_radio_group_new(&(cfdata->exposures));
ob = e_widget_radio_add(evas, _("Default"), E_CONFIG_EXPOSURES_DEFAULT, rg);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Allow"), E_CONFIG_EXPOSURES_ALLOWED, rg);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Don't Allow"), E_CONFIG_EXPOSURES_NOT_ALLOWED, rg);
- e_widget_disabled_set(ob, !cfdata->enable_screensaver); // set state from saved config
cfdata->disable_list = eina_list_append(cfdata->disable_list, ob);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5);
// handler for enable/disable widget array
- e_widget_on_change_hook_set(xscreensaver_check, _cb_disable_check_list, cfdata->disable_list);
+ e_widget_on_change_hook_set(xscreensaver_check, _cb_disable_adv, cfdata);
+ _cb_disable_adv(cfdata, NULL);
return o;
}
-/*!
- * @param data A Evas_Object to chain together with the checkbox
- * @param obj A Evas_Object checkbox created with e_widget_check_add()
- */
static void
-_cb_disable_check(void *data, Evas_Object *obj)
+_cb_disable_basic(void *data, Evas_Object *obj)
{
- e_widget_disabled_set((Evas_Object *) data,
- !e_widget_check_checked_get(obj));
+ E_Config_Dialog_Data *cfdata = data;
+ Eina_Bool disable = !cfdata->enable_screensaver;
+
+ e_widget_disabled_set(cfdata->gui.basic.label, disable);
+ e_widget_disabled_set(cfdata->gui.basic.slider, disable);
}
-/*!
- * @param data A Eina_List of Evas_Object to chain widgets together with the checkbox
- * @param obj A Evas_Object checkbox created with e_widget_check_add()
- */
static void
-_cb_disable_check_list(void *data, Evas_Object *obj)
+_cb_disable_adv(void *data, Evas_Object *obj __UNUSED__)
{
- Eina_List *list = (Eina_List*) data;
- Eina_List *l;
+ E_Config_Dialog_Data *cfdata = data;
+ const Eina_List *l;
Evas_Object *o;
- EINA_LIST_FOREACH(list, l, o)
- e_widget_disabled_set(o, !e_widget_check_checked_get(obj));
+ EINA_LIST_FOREACH(cfdata->disable_list, l, o)
+ e_widget_disabled_set(o, !cfdata->enable_screensaver);
+
+ _cb_ask_presentation_changed(cfdata, NULL);
+}
+
+static void
+_cb_ask_presentation_changed(void *data, Evas_Object *obj __UNUSED__)
+{
+ E_Config_Dialog_Data *cfdata = data;
+ Eina_Bool disable;
+
+ disable = ((!cfdata->enable_screensaver) || (!cfdata->ask_presentation));
+
+ e_widget_disabled_set(cfdata->gui.adv.ask_presentation_label, disable);
+ e_widget_disabled_set(cfdata->gui.adv.ask_presentation_slider, disable);
}