Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_embed.c ewl_embed.h ewl_misc.c ewl_misc.h 


Log Message:
Cleanup some globals in the embed.
Add some limits to work done at garbage collection time.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_embed.c 28 Oct 2005 05:00:55 -0000      1.17
+++ ewl_embed.c 1 Nov 2005 05:54:50 -0000       1.18
@@ -116,6 +116,19 @@
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
+void
+ewl_embed_shutdown(void)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       if (embedded_smart) {
+               evas_smart_free(embedded_smart);
+               embedded_smart = NULL;
+       }
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
 /**
  * @param emb: the embedded container to change the target evas
  * @param evas: the new evas to draw the container and it's contents
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_embed.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ewl_embed.h 28 Oct 2005 02:11:29 -0000      1.6
+++ ewl_embed.h 1 Nov 2005 05:54:50 -0000       1.7
@@ -70,7 +70,8 @@
 };
 
 Ewl_Widget     *ewl_embed_new(void);
-int             ewl_embed_init(Ewl_Embed *win);
+int             ewl_embed_init(Ewl_Embed *emb);
+void            ewl_embed_shutdown(void);
 Evas_Object    *ewl_embed_evas_set(Ewl_Embed *emb, Evas *evas,
                                   Ewl_Embed_Evas_Window *evas_window);
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_misc.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- ewl_misc.c  28 Oct 2005 05:00:55 -0000      1.24
+++ ewl_misc.c  1 Nov 2005 05:54:50 -0000       1.25
@@ -217,7 +217,7 @@
 
                while ((emb = ecore_list_remove_first(ewl_embed_list)))
                        ewl_widget_destroy(emb);
-               ewl_garbage_collect();
+               while (ewl_garbage_collect() > 0);
                ecore_list_destroy(ewl_embed_list);
                ewl_embed_list = NULL;
        }
@@ -230,6 +230,7 @@
        /*
         * Shut down the various EWL subsystems cleanly.
         */
+       ewl_embed_shutdown();
        ewl_callbacks_shutdown();
        ewl_theme_shutdown();
        ewl_config_shutdown();
@@ -315,6 +316,15 @@
        edje_freeze();
 
        /*
+        * Freeze events on the evases to reduce overhead
+        */
+       ecore_list_goto_first(ewl_embed_list);
+       while ((emb = ecore_list_next(ewl_embed_list)) != NULL) {
+               if (REALIZED(emb) && emb->evas)
+                       evas_event_freeze(emb->evas);
+       }
+
+       /*
         * Clean out the unused widgets first, to avoid them being drawn or
         * unnecessary work done from configuration. Then display new widgets,
         * finally layout the widgets.
@@ -324,15 +334,6 @@
                        !ecore_list_is_empty(free_evas_object_list))
                ewl_garbage_collect();
 
-       /*
-        * Freeze events on the evases to reduce overhead
-        */
-       ecore_list_goto_first(ewl_embed_list);
-       while ((emb = ecore_list_next(ewl_embed_list)) != NULL) {
-               if (REALIZED(emb) && emb->evas)
-                       evas_event_freeze(emb->evas);
-       }
-
        if (!ecore_list_is_empty(realize_list))
                ewl_realize_queue();
 
@@ -906,7 +907,13 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-void
+#define EWL_GC_LIMIT 300
+
+/**
+ * @return Returns TRUE if objects remain to be freed, otherwise false.
+ * @brief Free's all widgets that have been marked for destruction.
+ */
+int
 ewl_garbage_collect(void)
 {
        Evas *evas;
@@ -921,7 +928,8 @@
        if (print_gc_reap)
                printf("---\n");
 
-       while ((w = ecore_list_remove_first(destroy_list))) {
+       while ((cleanup < EWL_GC_LIMIT) &&
+                       (w = ecore_list_remove_first(destroy_list))) {
                if (ewl_object_queued_has(EWL_OBJECT(w),
                                          EWL_FLAG_QUEUED_CSCHEDULED))
                        ewl_configure_cancel_request(w);
@@ -954,7 +962,7 @@
        if (print_gc_reap)
                printf("---\n");
 
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
+       DRETURN_INT(ecore_list_nodes(destroy_list), DLEVEL_STABLE);
 }
 
 int ewl_ecore_exit(void *data __UNUSED__, int type __UNUSED__,
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_misc.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ewl_misc.h  24 Oct 2005 04:53:53 -0000      1.6
+++ ewl_misc.h  1 Nov 2005 05:54:50 -0000       1.7
@@ -30,7 +30,7 @@
 void            ewl_realize_cancel_request(Ewl_Widget *w);
 void            ewl_realize_queue(void);
 void            ewl_destroy_request(Ewl_Widget *w);
-void            ewl_garbage_collect(void);
+int             ewl_garbage_collect(void);
 void            ewl_realize_phase_enter(void);
 void            ewl_realize_phase_exit(void);
 int             ewl_in_realize_phase(void);




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to