discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=55bc44c9b853d52e6a1053342c4962c3093bc632

commit 55bc44c9b853d52e6a1053342c4962c3093bc632
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Mon Jan 27 16:16:41 2014 -0500

    feature: main idlers now freeze during screensaver to conserve power
---
 src/bin/e.h             |  2 ++
 src/bin/e_comp.c        |  2 ++
 src/bin/e_comp_canvas.c | 10 ++++++++++
 src/bin/e_main.c        | 18 ++++++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/src/bin/e.h b/src/bin/e.h
index 296f0bd..3e91a59 100644
--- a/src/bin/e.h
+++ b/src/bin/e.h
@@ -273,6 +273,8 @@ typedef struct _E_Rect         E_Rect;
 # include "e_includes.h"
 
 EAPI double          e_main_ts(const char *str);
+EINTERN void         e_main_idler_freeze(void);
+EINTERN void         e_main_idler_thaw(void);
 
 struct _E_Rect
 {
diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c
index c4f4128..c7e4acb 100644
--- a/src/bin/e_comp.c
+++ b/src/bin/e_comp.c
@@ -837,6 +837,8 @@ _e_comp_screensaver_off(void *data EINA_UNUSED, int type 
EINA_UNUSED, void *even
    EINA_LIST_FOREACH(compositors, l, c)
      {
         if (!c->saver) continue;
+        /* frozen in _e_comp_canvas_screensaver_active() */
+        e_main_idler_thaw();
         c->saver = EINA_FALSE;
         e_comp_render_queue(c);
         EINA_LIST_FOREACH(c->zones, ll, zone)
diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c
index 18b2298..c69136c 100644
--- a/src/bin/e_comp_canvas.c
+++ b/src/bin/e_comp_canvas.c
@@ -86,6 +86,15 @@ _e_comp_canvas_cb_mouse_wheel(E_Comp *c, Evas *e 
EINA_UNUSED, Evas_Object *obj E
 
 ////////////////////////////////////
 
+static void
+_e_comp_canvas_screensaver_active(void *d EINA_UNUSED, Evas_Object *obj 
EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
+{
+   /* thawed in _e_comp_screensaver_off() */
+   e_main_idler_freeze();
+}
+
+////////////////////////////////////
+
 static int
 _e_comp_canvas_cb_zone_sort(const void *data1, const void *data2)
 {
@@ -312,6 +321,7 @@ e_comp_canvas_zone_update(E_Zone *zone)
    evas_object_show(o);
 
    zone->over = o = edje_object_add(zone->comp->evas);
+   edje_object_signal_callback_add(o, "e,state,screensaver,active", "e", 
_e_comp_canvas_screensaver_active, NULL);
    evas_object_layer_set(o, E_LAYER_MAX);
    evas_object_raise(o);
    evas_object_name_set(zone->over, "zone->over");
diff --git a/src/bin/e_main.c b/src/bin/e_main.c
index 19ba829..94a652d 100644
--- a/src/bin/e_main.c
+++ b/src/bin/e_main.c
@@ -87,6 +87,7 @@ static Eina_Bool _e_main_cb_idle_after(void *data __UNUSED__);
 static Eina_Bool _e_main_cb_startup_fake_end(void *data __UNUSED__);
 
 /* local variables */
+static int idle_freeze = 0;
 static Eina_Bool really_know = EINA_FALSE;
 static Eina_Bool locked = EINA_FALSE;
 static Eina_Bool inloop = EINA_FALSE;
@@ -1714,3 +1715,20 @@ _e_main_cb_startup_fake_end(void *data __UNUSED__)
    return ECORE_CALLBACK_CANCEL;
 }
 
+EINTERN void
+e_main_idler_freeze(void)
+{
+   if (idle_freeze++) return;
+   E_FREE_FUNC(_idle_before, ecore_idle_enterer_del);
+   E_FREE_FUNC(_idle_after, ecore_idle_enterer_del);
+}
+
+EINTERN void
+e_main_idler_thaw(void)
+{
+   if (!idle_freeze) return;
+   if (--idle_freeze) return;
+
+   _idle_before = ecore_idle_enterer_before_add(_e_main_cb_idle_before, NULL);
+   _idle_after = ecore_idle_enterer_add(_e_main_cb_idle_after, NULL);
+}

-- 


Reply via email to