lots of buglet-fixing. this does:

1. make idle fade timer work at all (dodnt work before)
2. fixes backlight status on e restart
3. fixes setting bl level on start
4. improves the compositor fade in/out effect by ALSO fading backlight
in and out... oh so much smoother now
5. fixes label in ui to be seconds, not minutes.
6. in order to make this all work - it adds a special screensaver
event inside of e that the screensaver subsystem generates based on
the real x one.



SVN revision: 80538
devs/princeamd/enlightenment-0.17-elive
Carsten Haitzler 10 years ago
parent 504ba6fcd1
commit f0c9f5121c
  1. 71
      src/bin/e_backlight.c
  2. 4
      src/bin/e_backlight_main.c
  3. 2
      src/bin/e_config.c
  4. 63
      src/bin/e_dpms.c
  5. 27
      src/bin/e_main.c
  6. 51
      src/bin/e_manager.c
  7. 221
      src/bin/e_screensaver.c
  8. 6
      src/bin/e_screensaver.h
  9. 113
      src/modules/comp/e_mod_comp.c
  10. 16
      src/modules/conf_display/e_int_config_dpms.c
  11. 20
      src/modules/conf_display/e_int_config_screensaver.c

@ -13,6 +13,7 @@
static double bl_val = 1.0;
static double bl_animval = 1.0;
static double bl_delayval = 1.0;
static int sysmode = MODE_NONE;
static Ecore_Animator *bl_anim = NULL;
static Eina_List *bl_devs = NULL;
@ -26,14 +27,11 @@ static Ecore_Event_Handler *_e_backlight_handler_border_uniconify = NULL;
static Ecore_Event_Handler *_e_backlight_handler_border_desk_set = NULL;
static Ecore_Event_Handler *_e_backlight_handler_desk_show = NULL;
static Ecore_Timer *_e_backlight_timer = NULL;
static void _e_backlight_update(E_Zone *zone);
static void _e_backlight_set(E_Zone *zone, double val);
static Eina_Bool _bl_anim(void *data, double pos);
static Eina_Bool bl_avail = EINA_FALSE;
static Eina_Bool _e_backlight_handler(void *d, int type, void *ev);
static Eina_Bool _e_backlight_timer_cb(void *d);
#ifdef HAVE_EEZE
static const char *bl_sysval = NULL;
static Ecore_Event_Handler *bl_sys_exit_handler = NULL;
@ -90,7 +88,7 @@ e_backlight_init(void)
if (!getenv("E_RESTART"))
{
e_backlight_level_set(NULL, 0.0, 0.0);
e_backlight_level_set(NULL, e_config->backlight.normal, 1.0);
e_backlight_level_set(NULL, e_config->backlight.normal, 0.0);
}
}
@ -106,6 +104,10 @@ e_backlight_shutdown(void)
if (bl_anim) ecore_animator_del(bl_anim);
bl_anim = NULL;
if (e_config->backlight.mode != E_BACKLIGHT_MODE_NORMAL)
e_backlight_level_set(NULL, e_config->backlight.normal, 0.0);
EINA_LIST_FREE(bl_devs, s) eina_stringshare_del(s);
#ifdef HAVE_EEZE
if (bl_sysval) eina_stringshare_del(bl_sysval);
@ -193,31 +195,6 @@ e_backlight_update(void)
}
}
}
/* idle dimming disabled: clear timer */
if (!e_config->backlight.idle_dim)
{
if (_e_backlight_timer)
ecore_timer_del(_e_backlight_timer);
_e_backlight_timer = NULL;
return;
}
/* dimming enabled, timer active: update interval and reset */
if (_e_backlight_timer)
{
if (e_config->backlight.timer != ecore_timer_interval_get(_e_backlight_timer))
ecore_timer_interval_set(_e_backlight_timer, e_config->backlight.timer);
ecore_timer_reset(_e_backlight_timer);
return;
}
/* dimming enabled, timer inactive: */
/* timer is 0 seconds: return */
if (!e_config->backlight.timer) return;
/* current mode is dimmed: undim */
if (e_config->backlight.mode == E_BACKLIGHT_MODE_DIM)
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL);
_e_backlight_timer = ecore_timer_add(e_config->backlight.timer, _e_backlight_timer_cb, NULL);
}
EAPI void
@ -230,11 +207,11 @@ e_backlight_level_set(E_Zone *zone, double val, double tim)
// transition time
if (val < 0.0) val = 0.0;
else if (val > 1.0) val = 1.0;
if (val == bl_val) return;
if ((val == bl_val) && (!bl_anim)) return;
if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
bl_now = bl_val;
bl_val = val;
if (e_config->backlight.mode != E_BACKLIGHT_MODE_NORMAL) return;
// if (e_config->backlight.mode != E_BACKLIGHT_MODE_NORMAL) return;
if (tim < 0.0) tim = e_config->backlight.transition;
ecore_event_add(E_EVENT_BACKLIGHT_CHANGE, NULL, NULL, NULL);
if (tim == 0.0)
@ -266,11 +243,17 @@ e_backlight_mode_set(E_Zone *zone, E_Backlight_Mode mode)
if (e_config->backlight.mode == mode) return;
e_config->backlight.mode = mode;
if (e_config->backlight.mode == E_BACKLIGHT_MODE_NORMAL)
e_backlight_level_set(zone, bl_val, -1.0);
{
e_backlight_level_set(zone, e_config->backlight.normal, -1.0);
}
else if (e_config->backlight.mode == E_BACKLIGHT_MODE_OFF)
e_backlight_level_set(zone, 0.0, -1.0);
{
e_backlight_level_set(zone, 0.0, -1.0);
}
else if (e_config->backlight.mode == E_BACKLIGHT_MODE_DIM)
e_backlight_level_set(zone, e_config->backlight.dim, -1.0);
{
e_backlight_level_set(zone, e_config->backlight.dim, -1.0);
}
else if (e_config->backlight.mode == E_BACKLIGHT_MODE_MAX)
e_backlight_level_set(zone, 1.0, -1.0);
}
@ -297,14 +280,6 @@ _e_backlight_handler(void *d __UNUSED__, int type __UNUSED__, void *ev __UNUSED_
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_backlight_timer_cb(void *d __UNUSED__)
{
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_DIM);
_e_backlight_timer = NULL;
return EINA_FALSE;
}
static void
_e_backlight_update(E_Zone *zone)
{
@ -525,6 +500,8 @@ _bl_sys_level_get(void)
int maxval, val;
const char *str;
if (bl_anim) return;
str = eeze_udev_syspath_get_sysattr(bl_sysval, "max_brightness");
if (!str) return;
@ -538,7 +515,7 @@ _bl_sys_level_get(void)
eina_stringshare_del(str);
if ((val >= 0) && (val <= maxval))
bl_val = (double)val / (double)maxval;
// printf("GET: %i/%i (%1.3f)\n", val, maxval, bl_val);
// fprintf(stderr, "GET: %i/%i (%1.3f)\n", val, maxval, bl_val);
}
static Eina_Bool
@ -548,7 +525,8 @@ _e_bl_cb_ext_delay(void *data __UNUSED__)
if (bl_sys_pending_set)
{
bl_sys_pending_set = EINA_FALSE;
_bl_sys_level_set(bl_val);
_bl_sys_level_set(bl_delayval);
}
return EINA_FALSE;
}
@ -563,7 +541,7 @@ _e_bl_cb_exit(void *data __UNUSED__, int type __UNUSED__, void *event)
{
bl_sys_set_exe_ready = EINA_FALSE;
bl_sys_set_exe = NULL;
ecore_timer_add(0.1, _e_bl_cb_ext_delay, NULL);
ecore_timer_add(0.05, _e_bl_cb_ext_delay, NULL);
}
return ECORE_CALLBACK_RENEW;
}
@ -576,12 +554,13 @@ _bl_sys_level_set(double val)
if (!bl_sys_exit_handler)
bl_sys_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
_e_bl_cb_exit, NULL);
bl_delayval = val;
if ((bl_sys_set_exe) || (!bl_sys_set_exe_ready))
{
bl_sys_pending_set = EINA_TRUE;
return;
}
// printf("SET: %1.3f\n", val);
// fprintf(stderr, "SET: %1.3f\n", val);
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_backlight %i %s",
e_prefix_lib_get(), (int)(val * 1000.0), bl_sysval);

@ -113,7 +113,9 @@ main(int argc, char **argv)
if (maxlevel <= 0) maxlevel = 255;
if (curlevel >= 0)
{
curlevel = ((maxlevel * level) + (500 / maxlevel)) / 1000;
curlevel = ((maxlevel * level) + 500) / 1000;
if (curlevel > maxlevel) curlevel = maxlevel;
else if (curlevel < 0) curlevel = 0;
snprintf(buf, sizeof(buf), "%s/brightness", f);
return _bl_write_file(buf, curlevel);
}

@ -1395,7 +1395,7 @@ e_config_load(void)
E_CONFIG_LIMIT(e_config->dpms_suspend_timeout, 30, 5400);
E_CONFIG_LIMIT(e_config->dpms_off_timeout, 30, 5400);
E_CONFIG_LIMIT(e_config->backlight.timer, 30, 5400);
E_CONFIG_LIMIT(e_config->backlight.timer, 1, 3600);
E_CONFIG_LIMIT(e_config->screensaver_timeout, 30, 5400);
E_CONFIG_LIMIT(e_config->screensaver_interval, 0, 5400);

@ -22,9 +22,9 @@ e_dpms_update(void)
int enabled;
Eina_Bool changed = EINA_FALSE;
enabled = ((e_config->dpms_enable) && (!e_config->mode.presentation) &&
enabled = ((e_config->screensaver_enable) &&
(!e_config->mode.presentation) &&
(!e_util_fullscreen_current_any()));
if (_e_dpms_enabled != enabled)
{
_e_dpms_enabled = enabled;
@ -32,36 +32,28 @@ e_dpms_update(void)
}
if (!enabled) return;
if (e_config->dpms_standby_enable)
if (e_config->screensaver_enable)
{
standby = e_config->dpms_standby_timeout;
if (_e_dpms_timeout_standby != standby)
{
_e_dpms_timeout_standby = standby;
changed = EINA_TRUE;
}
off = suspend = standby = e_screensaver_timeout_get(EINA_FALSE);
standby += 5;
suspend += 6;
off += 7;
}
if (e_config->dpms_suspend_enable)
if (_e_dpms_timeout_standby != standby)
{
suspend = e_config->dpms_suspend_timeout;
if (_e_dpms_timeout_suspend != suspend)
{
_e_dpms_timeout_suspend = suspend;
changed = EINA_TRUE;
}
_e_dpms_timeout_standby = standby;
changed = EINA_TRUE;
}
if (e_config->dpms_off_enable)
if (_e_dpms_timeout_suspend != suspend)
{
off = e_config->dpms_off_timeout;
if (_e_dpms_timeout_off != off)
{
_e_dpms_timeout_off = off;
changed = EINA_TRUE;
}
_e_dpms_timeout_suspend = suspend;
changed = EINA_TRUE;
}
if (_e_dpms_timeout_off != off)
{
_e_dpms_timeout_off = off;
changed = EINA_TRUE;
}
if (changed) ecore_x_dpms_timeouts_set(standby, suspend, off);
}
@ -71,16 +63,19 @@ e_dpms_force_update(void)
unsigned int standby = 0, suspend = 0, off = 0;
int enabled;
enabled = ((e_config->dpms_enable) && (!e_config->mode.presentation) &&
enabled = ((e_config->screensaver_enable) &&
(!e_config->mode.presentation) &&
(!e_util_fullscreen_current_any()));
ecore_x_dpms_enabled_set(enabled);
if (!enabled) return;
if (e_config->dpms_standby_enable)
standby = e_config->dpms_standby_timeout;
if (e_config->dpms_suspend_enable)
suspend = e_config->dpms_suspend_timeout;
if (e_config->dpms_off_enable)
off = e_config->dpms_off_timeout;
if (e_config->screensaver_enable)
{
off = suspend = standby = e_screensaver_timeout_get(EINA_FALSE);
standby += 5;
suspend += 6;
off += 7;
}
ecore_x_dpms_timeouts_set(standby + 10, suspend + 10, off + 10);
ecore_x_dpms_timeouts_set(standby, suspend, off);
}
@ -144,7 +139,7 @@ e_dpms_init(void)
ecore_x_dpms_timeouts_get
(&_e_dpms_timeout_standby, &_e_dpms_timeout_suspend, &_e_dpms_timeout_off);
e_dpms_update();
e_dpms_force_update();
return 1;
}

@ -262,7 +262,6 @@ main(int argc, char **argv)
if (getenv("DESKTOP_STARTUP_ID"))
e_util_env_set("DESKTOP_STARTUP_ID", NULL);
e_util_env_set("E_RESTART_OK", NULL);
e_util_env_set("E_RESTART", "1");
e_util_env_set("PANTS", "ON");
e_util_env_set("DESKTOP", "Enlightenment-0.17.0");
TS("Environment Variables Done");
@ -659,6 +658,8 @@ main(int argc, char **argv)
efreet_icon_extension_add(".edj");
}
e_screensaver_preinit();
if (e_config->show_splash)
e_init_status_set(_("Setup Screens"));
TS("Screens Init");
@ -689,17 +690,6 @@ main(int argc, char **argv)
TS("E_Backlight Init Done");
_e_main_shutdown_push(e_backlight_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup DPMS"));
TS("E_Dpms Init");
if (!e_dpms_init())
{
e_error_message_show(_("Enlightenment cannot configure the DPMS settings.\n"));
_e_main_shutdown(-1);
}
TS("E_Dpms Init Done");
_e_main_shutdown_push(e_dpms_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Screensaver"));
TS("E_Screensaver Init");
@ -711,6 +701,17 @@ main(int argc, char **argv)
TS("E_Screensaver Init Done");
_e_main_shutdown_push(e_screensaver_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup DPMS"));
TS("E_Dpms Init");
if (!e_dpms_init())
{
e_error_message_show(_("Enlightenment cannot configure the DPMS settings.\n"));
_e_main_shutdown(-1);
}
TS("E_Dpms Init Done");
_e_main_shutdown_push(e_dpms_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Powersave Modes"));
TS("E_Powersave Init");
@ -1053,6 +1054,8 @@ main(int argc, char **argv)
starting = EINA_FALSE;
inloop = EINA_TRUE;
e_util_env_set("E_RESTART", "1");
TS("MAIN LOOP AT LAST");
if (!setjmp(x_fatal_buff))
ecore_main_loop_begin();

@ -9,7 +9,8 @@ static Eina_Bool _e_manager_cb_key_up(void *data, int ev_type, void *ev);
static Eina_Bool _e_manager_cb_key_down(void *data, int ev_type, void *ev);
static Eina_Bool _e_manager_cb_frame_extents_request(void *data, int ev_type, void *ev);
static Eina_Bool _e_manager_cb_ping(void *data, int ev_type, void *ev);
static Eina_Bool _e_manager_cb_screensaver_notify(void *data, int ev_type, void *ev);
static Eina_Bool _e_manager_cb_screensaver_on(void *data, int ev_type, void *ev);
static Eina_Bool _e_manager_cb_screensaver_off(void *data, int ev_type, void *ev);
static Eina_Bool _e_manager_cb_client_message(void *data, int ev_type, void *ev);
static Eina_Bool _e_manager_frame_extents_free_cb(const Eina_Hash *hash __UNUSED__,
@ -127,8 +128,13 @@ e_manager_new(Ecore_X_Window root, int num)
man));
man->handlers =
eina_list_append(man->handlers,
ecore_event_handler_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY,
_e_manager_cb_screensaver_notify,
ecore_event_handler_add(E_EVENT_SCREENSAVER_ON,
_e_manager_cb_screensaver_on,
man));
man->handlers =
eina_list_append(man->handlers,
ecore_event_handler_add(E_EVENT_SCREENSAVER_OFF,
_e_manager_cb_screensaver_off,
man));
man->handlers =
eina_list_append(man->handlers,
@ -934,32 +940,33 @@ _e_manager_cb_timer_post_screensaver_lock(void *data __UNUSED__)
}
static Eina_Bool
_e_manager_cb_screensaver_notify(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
_e_manager_cb_screensaver_on(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
{
Ecore_X_Event_Screensaver_Notify *e = ev;
if (e_config->desklock_autolock_screensaver)
{
if (timer_post_screensaver_lock)
{
ecore_timer_del(timer_post_screensaver_lock);
timer_post_screensaver_lock = NULL;
}
if (e_config->desklock_post_screensaver_time <= 1.0)
e_desklock_show_autolocked();
else
timer_post_screensaver_lock = ecore_timer_add
(e_config->desklock_post_screensaver_time,
_e_manager_cb_timer_post_screensaver_lock, NULL);
}
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_manager_cb_screensaver_off(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
{
if (timer_post_screensaver_lock)
{
ecore_timer_del(timer_post_screensaver_lock);
timer_post_screensaver_lock = NULL;
}
if (e->on)
{
if (e_config->desklock_autolock_screensaver)
{
if (e_config->desklock_post_screensaver_time <= 1.0)
{
e_desklock_show_autolocked();
}
else
{
timer_post_screensaver_lock = ecore_timer_add
(e_config->desklock_post_screensaver_time,
_e_manager_cb_timer_post_screensaver_lock, NULL);
}
}
}
return ECORE_CALLBACK_PASS_ON;
}

@ -1,5 +1,7 @@
#include "e.h"
static Ecore_Event_Handler *_e_screensaver_handler_on = NULL;
static Ecore_Event_Handler *_e_screensaver_handler_off = NULL;
static Ecore_Event_Handler *_e_screensaver_handler_config_mode = NULL;
static Ecore_Event_Handler *_e_screensaver_handler_screensaver_notify = NULL;
static Ecore_Event_Handler *_e_screensaver_handler_border_fullscreen = NULL;
@ -21,17 +23,42 @@ static int _e_screensaver_expose = 0;
static Ecore_Timer *_e_screensaver_suspend_timer = NULL;
static Eina_Bool _e_screensaver_on = EINA_FALSE;
EAPI int E_EVENT_SCREENSAVER_ON = -1;
EAPI int E_EVENT_SCREENSAVER_OFF = -1;
EAPI int
e_screensaver_timeout_get(Eina_Bool use_idle)
{
int timeout = 0, count = (1 + _e_screensaver_ask_presentation_count);
if ((e_config->screensaver_enable) && (!e_config->mode.presentation) &&
(!e_util_fullscreen_current_any()))
timeout = e_config->screensaver_timeout * count;
if (use_idle)
{
if (e_config->backlight.idle_dim)
{
if (timeout > 0)
{
if (e_config->backlight.timer < timeout)
timeout = e_config->backlight.timer;
}
else
timeout = e_config->backlight.timer;
}
}
return timeout;
}
EAPI void
e_screensaver_update(void)
{
int timeout = 0, interval = 0, blanking = 0, expose = 0;
int count = (1 + _e_screensaver_ask_presentation_count);
Eina_Bool changed = EINA_FALSE;
if ((e_config->screensaver_enable) && (!e_config->mode.presentation) &&
(!e_util_fullscreen_current_any()))
timeout = e_config->screensaver_timeout * count;
timeout = e_screensaver_timeout_get(EINA_TRUE);
interval = e_config->screensaver_interval;
blanking = e_config->screensaver_blanking;
expose = e_config->screensaver_expose;
@ -63,11 +90,8 @@ e_screensaver_update(void)
EAPI void
e_screensaver_force_update(void)
{
int timeout = 0, count = (1 + _e_screensaver_ask_presentation_count);
int timeout = e_screensaver_timeout_get(EINA_TRUE);
if ((e_config->screensaver_enable) && (!e_config->mode.presentation) &&
(!e_util_fullscreen_current_any()))
timeout = e_config->screensaver_timeout * count;
ecore_x_screensaver_set(timeout + 10,
0,
// e_config->screensaver_interval,
@ -209,54 +233,123 @@ _e_screensaver_handler_powersave_cb(void *data __UNUSED__, int type __UNUSED__,
return ECORE_CALLBACK_PASS_ON;
}
static double last_start = 0.0;
static Eina_Bool
_e_screensaver_handler_screensaver_notify_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
_e_screensaver_handler_screensaver_on_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
Ecore_X_Event_Screensaver_Notify *e = event;
static double last_start = 0.0;
if (e->on)
{
_e_screensaver_on = EINA_TRUE;
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
_e_screensaver_on = EINA_TRUE;
if (_e_screensaver_suspend_timer)
{
// e_screensaver_force_update();
// e_dpms_force_update();
_e_screensaver_on = EINA_FALSE;
if (_e_screensaver_suspend_timer)
{
ecore_timer_del(_e_screensaver_suspend_timer);
_e_screensaver_suspend_timer = NULL;
}
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);
last_start = ecore_loop_time_get();
_e_screensaver_ask_presentation_count = 0;
return ECORE_CALLBACK_PASS_ON;
}
if (e->on)
static Eina_Bool
_e_screensaver_handler_screensaver_off_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
// e_screensaver_force_update();
// e_dpms_force_update();
_e_screensaver_on = EINA_FALSE;
if (_e_screensaver_suspend_timer)
{
last_start = ecore_loop_time_get();
_e_screensaver_ask_presentation_count = 0;
ecore_timer_del(_e_screensaver_suspend_timer);
_e_screensaver_suspend_timer = NULL;
}
else if ((last_start > 0.0) && (e_config->screensaver_ask_presentation))
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)
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 ECORE_CALLBACK_PASS_ON;
}
static Ecore_Timer *idle_timer = NULL;
static Eina_Bool saver_on = EINA_FALSE;
static Eina_Bool dimmed = EINA_FALSE;
static Eina_Bool
_e_screensaver_idle_timer_cb(void *d __UNUSED__)
{
ecore_event_add(E_EVENT_SCREENSAVER_ON, NULL, NULL, NULL);
idle_timer = 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;
if ((e->on) && (!saver_on))
{
saver_on = EINA_TRUE;
if (e_config->backlight.idle_dim)
{
double t = e_config->screensaver_timeout -
e_config->backlight.timer;
if (t < 1.0) t = 1.0;
if (idle_timer)
{
ecore_timer_del(idle_timer);
idle_timer = NULL;
}
if (e_config->screensaver_enable)
idle_timer = ecore_timer_add
(t, _e_screensaver_idle_timer_cb, NULL);
if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_DIM)
{
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_DIM);
dimmed = EINA_TRUE;
}
}
else
{
if (!_e_screensaver_on)
ecore_event_add(E_EVENT_SCREENSAVER_ON, NULL, NULL, NULL);
}
}
else if ((!e->on) && (saver_on))
{
saver_on = EINA_FALSE;
if (idle_timer)
{
ecore_timer_del(idle_timer);
idle_timer = NULL;
if (e_config->backlight.idle_dim)
{
if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_NORMAL)
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL);
}
}
else
{
if (dimmed)
{
if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_NORMAL)
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL);
dimmed = EINA_FALSE;
}
if (_e_screensaver_on)
ecore_event_add(E_EVENT_SCREENSAVER_OFF, NULL, NULL, NULL);
}
}
return ECORE_CALLBACK_PASS_ON;
}
@ -281,45 +374,53 @@ _e_screensaver_handler_desk_show_cb(void *data __UNUSED__, int type __UNUSED__,
return ECORE_CALLBACK_PASS_ON;
}
EINTERN void
e_screensaver_preinit(void)
{
E_EVENT_SCREENSAVER_ON = ecore_event_type_new();
E_EVENT_SCREENSAVER_OFF = ecore_event_type_new();
}
EINTERN int
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);
ecore_x_screensaver_custom_blanking_enable();
_e_screensaver_handler_on = ecore_event_handler_add
(E_EVENT_SCREENSAVER_ON, _e_screensaver_handler_screensaver_on_cb, NULL);
_e_screensaver_handler_off = ecore_event_handler_add
(E_EVENT_SCREENSAVER_OFF, _e_screensaver_handler_screensaver_off_cb, NULL);
_e_screensaver_handler_screensaver_notify = ecore_event_handler_add
(ECORE_X_EVENT_SCREENSAVER_NOTIFY, _e_screensaver_handler_screensaver_notify_cb, NULL);
_e_screensaver_handler_config_mode = ecore_event_handler_add
(E_EVENT_CONFIG_MODE_CHANGED, _e_screensaver_handler_config_mode_cb, NULL);
_e_screensaver_handler_border_fullscreen = ecore_event_handler_add
(E_EVENT_BORDER_FULLSCREEN, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_unfullscreen = ecore_event_handler_add
(E_EVENT_BORDER_UNFULLSCREEN, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_remove = ecore_event_handler_add
(E_EVENT_BORDER_REMOVE, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_iconify = ecore_event_handler_add
(E_EVENT_BORDER_ICONIFY, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_uniconify = ecore_event_handler_add
(E_EVENT_BORDER_UNICONIFY, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
_e_screensaver_handler_border_desk_set = ecore_event_handler_add
(E_EVENT_BORDER_DESK_SET, _e_screensaver_handler_border_desk_set_cb, NULL);
_e_screensaver_handler_desk_show = ecore_event_handler_add
(E_EVENT_DESK_SHOW, _e_screensaver_handler_desk_show_cb, NULL);
_e_screensaver_handler_powersave = ecore_event_handler_add
(E_EVENT_POWERSAVE_UPDATE, _e_screensaver_handler_powersave_cb, NULL);
_e_screensaver_timeout = ecore_x_screensaver_timeout_get();
// _e_screensaver_interval = ecore_x_screensaver_interval_get();
_e_screensaver_blanking = ecore_x_screensaver_blank_get();
_e_screensaver_expose = ecore_x_screensaver_expose_get();
e_screensaver_update();
e_screensaver_force_update();
return 1;
}
@ -327,11 +428,25 @@ e_screensaver_init(void)
EINTERN int
e_screensaver_shutdown(void)
{
if (_e_screensaver_handler_on)
{
ecore_event_handler_del(_e_screensaver_handler_on);
_e_screensaver_handler_on = NULL;
}
if (_e_screensaver_handler_off)
{
ecore_event_handler_del(_e_screensaver_handler_off);
_e_screensaver_handler_off = NULL;
}
if (_e_screensaver_suspend_timer)
{
ecore_timer_del(_e_screensaver_suspend_timer);
_e_screensaver_suspend_timer = NULL;
}
ecore_x_screensaver_custom_blanking_disable();
if (_e_screensaver_handler_powersave)
{

@ -3,11 +3,17 @@
#ifndef E_SCREENSAVER_H
#define E_SCREENSAVER_H
EINTERN void e_screensaver_preinit(void);
EINTERN int e_screensaver_init(void);
EINTERN int e_screensaver_shutdown(void);
EAPI void e_screensaver_update(void);
EAPI void e_screensaver_force_update(void);
EAPI int e_screensaver_timeout_get(Eina_Bool use_idle);
EAPI extern int E_EVENT_SCREENSAVER_ON;
EAPI extern int E_EVENT_SCREENSAVER_OFF;
#endif
#endif

@ -72,6 +72,8 @@ struct _E_Comp_Zone
int container_num;
int zone_num;
int x, y, w, h;
double bl;
Eina_Bool bloff;
};
struct _E_Comp_Win
@ -3033,12 +3035,38 @@ _e_mod_comp_override_push(E_Comp *c)
if ((c->nocomp_override > 0) && (c->nocomp)) _e_mod_comp_cb_nocomp_end(c);
}
static void
_e_mod_comp_fade_handle(E_Comp_Zone *cz, int out, double tim)
{
if (out == 1)
{
if (e_backlight_exists())
{
e_backlight_update();
cz->bloff = EINA_TRUE;
cz->bl = e_backlight_level_get(cz->zone);
e_backlight_level_set(cz->zone, 0.0, tim);
}
}
else
{
if (e_backlight_exists())
{
cz->bloff = EINA_FALSE;
e_backlight_update();
if (e_backlight_mode_get(cz->zone) != E_BACKLIGHT_MODE_NORMAL)
e_backlight_mode_set(cz->zone, E_BACKLIGHT_MODE_NORMAL);
else
e_backlight_level_set(cz->zone, e_config->backlight.normal, tim);
}
}
}
static Eina_Bool
_e_mod_comp_screensaver(void *data __UNUSED__,
int type __UNUSED__,
void *event)
_e_mod_comp_screensaver_on(void *data __UNUSED__,
int type __UNUSED__,
void *event __UNUSED__)
{
Ecore_X_Event_Screensaver_Notify *ev = event;
Eina_List *l, *ll;
E_Comp_Zone *cz;
E_Comp *c;
@ -3046,27 +3074,46 @@ _e_mod_comp_screensaver(void *data __UNUSED__,
// fixme: use hash if compositors list > 4
EINA_LIST_FOREACH(compositors, l, c)
{
if (ev->on != c->saver)
if (!c->saver)
{
c->saver = ev->on;
c->saver = EINA_TRUE;
EINA_LIST_FOREACH(c->zones, ll, cz)
{
if (c->saver)
{
_e_mod_comp_override_push(c);
edje_object_signal_emit(cz->base,
"e,state,screensaver,on", "e");
edje_object_signal_emit(cz->over,
"e,state,screensaver,on", "e");
}
else
{
_e_mod_comp_override_timed_pop(c);
edje_object_signal_emit(cz->base,
"e,state,screensaver,off", "e");
edje_object_signal_emit(cz->over,
"e,state,screensaver,off", "e");
}
_e_mod_comp_override_push(c);
_e_mod_comp_fade_handle(cz, 1, 3.0);
edje_object_signal_emit(cz->base,
"e,state,screensaver,on", "e");
edje_object_signal_emit(cz->over,
"e,state,screensaver,on", "e");
}
}
}
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_mod_comp_screensaver_off(void *data __UNUSED__,
int type __UNUSED__,
void *event __UNUSED__)
{
Eina_List *l, *ll;
E_Comp_Zone *cz;
E_Comp *c;
// fixme: use hash if compositors list > 4
EINA_LIST_FOREACH(compositors, l, c)
{
if (c->saver)
{
c->saver = EINA_FALSE;
EINA_LIST_FOREACH(c->zones, ll, cz)
{
edje_object_signal_emit(cz->base,
"e,state,screensaver,off", "e");
edje_object_signal_emit(cz->over,
"e,state,screensaver,off", "e");
_e_mod_comp_fade_handle(cz, 0, 0.5);
_e_mod_comp_override_timed_pop(c);
}
}
}
@ -3108,6 +3155,12 @@ _e_mod_comp_screens_eval(E_Comp *c)
{
evas_object_del(cz->base);
evas_object_del(cz->over);
if (cz->bloff)
{
if (e_backlight_mode_get(cz->zone) != E_BACKLIGHT_MODE_NORMAL)
e_backlight_mode_set(cz->zone, E_BACKLIGHT_MODE_NORMAL);
e_backlight_level_set(cz->zone, e_config->backlight.normal, 0.0);
}
free(cz);
}
cn = 0;
@ -3882,6 +3935,12 @@ _e_mod_comp_del(E_Comp *c)
{
evas_object_del(cz->base);
evas_object_del(cz->over);
if (cz->bloff)
{
if (e_backlight_mode_get(cz->zone) != E_BACKLIGHT_MODE_NORMAL)
e_backlight_mode_set(cz->zone, E_BACKLIGHT_MODE_NORMAL);
e_backlight_level_set(cz->zone, e_config->backlight.normal, 0.0);
}
free(cz);
}
@ -3937,6 +3996,8 @@ _e_mod_comp_sys_emit_cb_wait(E_Sys_Action a, const char *sig, const char *rep, E
else _e_mod_comp_override_timed_pop(c);
EINA_LIST_FOREACH(c->zones, ll, cz)
{
if (nocomp_push) _e_mod_comp_fade_handle(cz, 1, 0.5);
else _e_mod_comp_fade_handle(cz, 0, 0.5);
edje_object_signal_emit(cz->base, sig, "e");
edje_object_signal_emit(cz->over, sig, "e");
if ((rep) && (first))
@ -4021,8 +4082,6 @@ e_mod_comp_init(void)
borders = eina_hash_string_superfast_new(NULL);
damages = eina_hash_string_superfast_new(NULL);
ecore_x_screensaver_custom_blanking_enable();
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_CREATE, _e_mod_comp_create, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DESTROY, _e_mod_comp_destroy, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHOW, _e_mod_comp_show, NULL);
@ -4035,7 +4094,9 @@ e_mod_comp_init(void)
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_SHAPE, _e_mod_comp_shape, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_DAMAGE_NOTIFY, _e_mod_comp_damage, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DAMAGE, _e_mod_comp_damage_win, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SCREENSAVER_NOTIFY, _e_mod_comp_screensaver, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_mod_comp_screensaver_on, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _e_mod_comp_screensaver_off, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _e_mod_comp_key_down, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_SIGNAL_USER, _e_mod_comp_signal_user, NULL);
@ -4108,8 +4169,6 @@ e_mod_comp_shutdown(void)
e_mod_comp_wl_shutdown();
#endif
ecore_x_screensaver_custom_blanking_disable();
if (damages) eina_hash_free(damages);
if (windows) eina_hash_free(windows);
if (borders) eina_hash_free(borders);

@ -81,11 +81,12 @@ _apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
e_config->backlight.normal = cfdata->backlight_normal / 100.0;
e_config->backlight.dim = cfdata->backlight_dim / 100.0;
e_config->backlight.transition = cfdata->backlight_transition;
e_config->backlight.timer = lround(cfdata->backlight_timeout * 60.);
e_config->backlight.timer = lround(cfdata->backlight_timeout);
e_config->backlight.idle_dim = cfdata->enable_idle_dim;
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL);
e_backlight_level_set(NULL, e_config->backlight.normal, -1.0);
if (cfdata->backlight_timeout < e_config->screensaver_timeout)
if (cfdata->backlight_timeout > (e_config->screensaver_timeout))
{
e_config->screensaver_timeout = cfdata->backlight_timeout;
e_config->dpms_standby_timeout = e_config->screensaver_timeout;
@ -103,10 +104,12 @@ _apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
static int
_advanced_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
e_widget_disabled_set(cfdata->backlight_slider, !cfdata->enable_idle_dim); // set state from saved config
return (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.timer != cfdata->backlight_timeout);
(e_config->backlight.timer != cfdata->backlight_timeout) ||
(e_config->backlight.idle_dim != cfdata->enable_idle_dim);
}
static int
@ -156,16 +159,15 @@ _advanced_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_D
ob = e_widget_check_add(evas, _("Idle Fade Time"), &(cfdata->enable_idle_dim));
e_widget_list_object_append(o, ob, 1, 1, 0.5);
e_widget_disabled_set(ob, cfdata->enable_idle_dim); // set state from saved config
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"), 0.5, 90.0, 1.0, 0,
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f second(s)"), 5.0, 300.0, 1.0, 0,
&(cfdata->backlight_timeout), NULL, 100);
cfdata->backlight_slider = ob;
e_widget_disabled_set(ob, cfdata->enable_idle_dim); // set state from saved config
e_widget_disabled_set(ob, !cfdata->enable_idle_dim); // set state from saved config
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 s"), 0.0, 5.0, 0.1, 0,
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f second(s)"), 0.0, 5.0, 0.1, 0,
&(cfdata->backlight_transition), NULL, 100);
e_widget_list_object_append(o, ob, 1, 1, 0.5);

@ -65,7 +65,7 @@ static void
_fill_data(E_Config_Dialog_Data *cfdata)
{
cfdata->enable_screensaver = e_config->screensaver_enable;
cfdata->timeout = (double)e_config->screensaver_timeout / 60.;
cfdata->timeout = (double)e_config->screensaver_timeout / 60.0;
cfdata->ask_presentation = e_config->screensaver_ask_presentation;
cfdata->presentation_mode = e_config->mode.presentation;
cfdata->ask_presentation_timeout = e_config->screensaver_ask_presentation_timeout;
@ -96,7 +96,7 @@ static int
_basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
e_config->screensaver_enable = cfdata->enable_screensaver;
e_config->screensaver_timeout = lround(cfdata->timeout * 60);
e_config->screensaver_timeout = lround(cfdata->timeout * 60.0);
e_config->screensaver_ask_presentation = cfdata->ask_presentation;
e_config->mode.presentation = cfdata->presentation_mode;
e_config->screensaver_ask_presentation_timeout = cfdata->ask_presentation_timeout;
@ -105,14 +105,14 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
e_config->screensaver_suspend_delay = cfdata->screensaver_suspend_delay;
// enough of dpms vs screensaver being different! useless
e_config->dpms_enable = e_config->screensaver_enable;
e_config->dpms_standby_enable = e_config->dpms_enable;
e_config->dpms_suspend_enable = e_config->dpms_enable;
e_config->dpms_off_enable = e_config->dpms_enable;
// e_config->dpms_enable = e_config->screensaver_enable;
// e_config->dpms_standby_enable = e_config->dpms_enable;
// e_config->dpms_suspend_enable = e_config->dpms_enable;
// e_config->dpms_off_enable = e_config->dpms_enable;
// XXX: 5 seconds after screenblank until dpms - enough for most anims;
e_config->dpms_standby_timeout = e_config->screensaver_timeout + 5;
e_config->dpms_suspend_timeout = e_config->screensaver_timeout + 6;
e_config->dpms_off_timeout = e_config->screensaver_timeout + 7;
// e_config->dpms_standby_timeout = e_config->screensaver_timeout;
// e_config->dpms_suspend_timeout = e_config->screensaver_timeout;
// e_config->dpms_off_timeout = e_config->screensaver_timeout;
e_config->screensaver_interval = 0;
@ -128,7 +128,7 @@ static int
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
return ((e_config->screensaver_enable != cfdata->enable_screensaver) ||
(e_config->screensaver_timeout != lround(cfdata->timeout * 60)) ||
(e_config->screensaver_timeout != lround(cfdata->timeout * 60.0)) ||
(e_config->screensaver_ask_presentation != cfdata->ask_presentation) ||
(e_config->mode.presentation != cfdata->presentation_mode) ||
(e_config->screensaver_ask_presentation_timeout != cfdata->ask_presentation_timeout) ||

Loading…
Cancel
Save