and also use same delay from screensaver start to suspend for power
authorCarsten Haitzler <raster@rasterman.com>
Sun, 21 Aug 2011 11:14:36 +0000 (11:14 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sun, 21 Aug 2011 11:14:36 +0000 (11:14 +0000)
removed to suspend.

SVN revision: 62657

src/bin/e_screensaver.c

index 237be18..6229193 100644 (file)
@@ -163,21 +163,6 @@ _e_screensaver_ask_presentation_mode(void)
 }
 
 static Eina_Bool
-_e_screensaver_handler_powersave_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
-{
-   if ((_e_screensaver_on) && (!_e_screensaver_suspend_timer))
-     {
-        if (e_config->screensaver_suspend)
-          {
-             if ((e_config->screensaver_suspend_on_ac) ||
-                 (e_powersave_mode_get() > E_POWERSAVE_MODE_LOW))
-                e_sys_action_do(E_SYS_SUSPEND, NULL);
-          }
-     }
-   return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
 _e_screensaver_suspend_cb(void *data __UNUSED__)
 {
    _e_screensaver_suspend_timer = NULL;
@@ -191,6 +176,20 @@ _e_screensaver_suspend_cb(void *data __UNUSED__)
 }
 
 static Eina_Bool
+_e_screensaver_handler_powersave_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
+{
+   if ((e_config->screensaver_suspend) && (_e_screensaver_on))
+     {
+        if (_e_screensaver_suspend_timer)
+           ecore_timer_del(_e_screensaver_suspend_timer);
+        _e_screensaver_suspend_timer = 
+           ecore_timer_add(e_config->screensaver_suspend_delay,
+                           _e_screensaver_suspend_cb, NULL);
+     }
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
 _e_screensaver_handler_screensaver_notify_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
 {
    Ecore_X_Event_Screensaver_Notify *e = event;