forked from enlightenment/enlightenment
feature: main idlers now freeze during screensaver to conserve power
This commit is contained in:
parent
cf267da573
commit
55bc44c9b8
|
@ -273,6 +273,8 @@ typedef struct _E_Rect E_Rect;
|
||||||
# include "e_includes.h"
|
# include "e_includes.h"
|
||||||
|
|
||||||
EAPI double e_main_ts(const char *str);
|
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
|
struct _E_Rect
|
||||||
{
|
{
|
||||||
|
|
|
@ -837,6 +837,8 @@ _e_comp_screensaver_off(void *data EINA_UNUSED, int type EINA_UNUSED, void *even
|
||||||
EINA_LIST_FOREACH(compositors, l, c)
|
EINA_LIST_FOREACH(compositors, l, c)
|
||||||
{
|
{
|
||||||
if (!c->saver) continue;
|
if (!c->saver) continue;
|
||||||
|
/* frozen in _e_comp_canvas_screensaver_active() */
|
||||||
|
e_main_idler_thaw();
|
||||||
c->saver = EINA_FALSE;
|
c->saver = EINA_FALSE;
|
||||||
e_comp_render_queue(c);
|
e_comp_render_queue(c);
|
||||||
EINA_LIST_FOREACH(c->zones, ll, zone)
|
EINA_LIST_FOREACH(c->zones, ll, zone)
|
||||||
|
|
|
@ -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
|
static int
|
||||||
_e_comp_canvas_cb_zone_sort(const void *data1, const void *data2)
|
_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);
|
evas_object_show(o);
|
||||||
|
|
||||||
zone->over = o = edje_object_add(zone->comp->evas);
|
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_layer_set(o, E_LAYER_MAX);
|
||||||
evas_object_raise(o);
|
evas_object_raise(o);
|
||||||
evas_object_name_set(zone->over, "zone->over");
|
evas_object_name_set(zone->over, "zone->over");
|
||||||
|
|
|
@ -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__);
|
static Eina_Bool _e_main_cb_startup_fake_end(void *data __UNUSED__);
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
|
static int idle_freeze = 0;
|
||||||
static Eina_Bool really_know = EINA_FALSE;
|
static Eina_Bool really_know = EINA_FALSE;
|
||||||
static Eina_Bool locked = EINA_FALSE;
|
static Eina_Bool locked = EINA_FALSE;
|
||||||
static Eina_Bool inloop = 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;
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue