Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/entrance

Dir     : e17/apps/entrance/src/client


Modified Files:
        main.c 


Log Message:


use the new screensaver info to pasue edje and flush caches to save ram - if
the ss is active - the box is very much idle. no one is looking at its screen
(it's blank) so no need to consume excess ram and cpu. sleep nicely. wake up
again when screensaver stops
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entrance/src/client/main.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- main.c      26 Aug 2005 04:23:44 -0000      1.75
+++ main.c      3 Mar 2006 09:41:31 -0000       1.76
@@ -22,6 +22,7 @@
 #define WINH 600
 
 static Entrance_Session *session = NULL;
+static Evas_Object *edje;
 
 static int
 idler_before_cb(void *data)
@@ -72,6 +73,38 @@
 }
 
 /**
+ * Called when the screensaver starts/stops
+ */
+static int
+screensaver_notify_cb(void *data, int ev_type, void *ev)
+{
+   Ecore_X_Event_Screensaver_Notify *e;
+   
+   e = ev;
+   if (e->on)
+     {
+       int size;
+       
+       edje_object_play_set(edje, 0);
+       edje_freeze();
+       size = evas_image_cache_get(evas_object_evas_get(edje));
+       evas_image_cache_set(evas_object_evas_get(edje), 0);
+       evas_image_cache_set(evas_object_evas_get(edje), size);
+       size = evas_font_cache_get(evas_object_evas_get(edje));
+       evas_font_cache_set(evas_object_evas_get(edje), 0);
+       evas_font_cache_set(evas_object_evas_get(edje), size);
+       /* FIXME: it'd be nice to literally delete all the evas objects
+        * to nuke even mroe memory use here */
+     }
+   else 
+     {
+       edje_thaw();
+       edje_object_play_set(edje, 1);
+     }
+   return 1;
+}
+
+/**
  * what to do if we SIGINT(^c) it
  * @param data - no clue
  * @param ev_type - kill event ?
@@ -607,7 +640,7 @@
    Evas *evas = NULL;
    Ecore_Evas *e = NULL;
    Ecore_Timer *timer = NULL;
-   Evas_Object *o = NULL, *edje = NULL;
+   Evas_Object *o = NULL;
    Evas_Coord x, y, w, h;
    char *entries[] = { "entrance.entry.user", "entrance.entry.pass" };
    int entries_count = 2;
@@ -765,6 +798,9 @@
    }
    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_cb, NULL);
    ecore_idle_enterer_add(idler_before_cb, NULL);
+   
+   ecore_event_handler_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, 
screensaver_notify_cb, NULL);
+   ecore_x_screensaver_event_listen_set(1);
 
    if (ecore_evas_init())
    {




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to