Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_cell.c ewl_row.c ewl_row.h ewl_tree.c 


Log Message:
Zero out structs after allocating and before passing to init functions.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_cell.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_cell.c  2 Feb 2003 21:03:23 -0000       1.1
+++ ewl_cell.c  2 Feb 2003 23:07:22 -0000       1.2
@@ -17,6 +17,7 @@
        if (!cell)
                DRETURN_PTR(NULL, DLEVEL_STABLE);
 
+       ZERO(cell, Ewl_Cell, 1);
        if (!ewl_cell_init(EWL_CELL(cell))) {
                FREE(cell);
                DRETURN_PTR(NULL, DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_row.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_row.c   2 Feb 2003 21:03:23 -0000       1.1
+++ ewl_row.c   2 Feb 2003 23:07:23 -0000       1.2
@@ -2,6 +2,9 @@
 
 static void __ewl_row_configure(Ewl_Widget * w, void *ev_data, void *user_data);
 
+static void __ewl_row_resize(Ewl_Container *c, Ewl_Widget *w, int size,
+               Ewl_Orientation o);
+
 /**
  * ewl_row_new - allocate and initialize a new row
  *
@@ -17,6 +20,7 @@
        if (!row)
                DRETURN_PTR(NULL, DLEVEL_STABLE);
 
+       ZERO(row, Ewl_Row, 1);
        if (!ewl_row_init(EWL_ROW(row))) {
                FREE(row);
                DRETURN_PTR(NULL, DLEVEL_STABLE);
@@ -38,7 +42,7 @@
 
        DCHECK_PARAM_PTR_RET("row", row, FALSE);
 
-       ewl_container_init(EWL_CONTAINER(row), "row", NULL, NULL);
+       ewl_container_init(EWL_CONTAINER(row), "row", NULL, __ewl_row_resize);
 
        ewl_callback_append(EWL_WIDGET(row), EWL_CALLBACK_CONFIGURE,
                        __ewl_row_configure, NULL);
@@ -46,6 +50,10 @@
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
+/**
+ * ewl_row_set_cell_widths - set the table of constraints on cell widths
+ */
+
 static void
 __ewl_row_configure(Ewl_Widget * w, void *ev_data, void *user_data)
 {
@@ -72,4 +80,32 @@
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+__ewl_row_resize(Ewl_Container *c, Ewl_Widget *w, int size, Ewl_Orientation o)
+{
+       Ewl_Row *row;
+
+       row = EWL_ROW(c);
+       if (o == EWL_ORIENTATION_VERTICAL) {
+               if (w == row->max && size > 0)
+                       PREFERRED_H(c) += size;
+               else {
+                       int h;
+                       int max_h = 0;
+                       Ewl_Object *child;
+
+                       ewd_list_goto_first(c->children);
+                       while ((child = ewd_list_next(c->children))) {
+                               h = ewl_object_get_preferred_h(child);
+                               if (h > max_h) {
+                                       max_h = h;
+                                       row->max = EWL_WIDGET(child);
+                               }
+                       }
+
+                       PREFERRED_H(c) = max_h;
+               }
+       }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_row.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_row.h   2 Feb 2003 21:03:23 -0000       1.1
+++ ewl_row.h   2 Feb 2003 23:07:23 -0000       1.2
@@ -10,6 +10,7 @@
 struct _ewl_row
 {
        Ewl_Container container;
+       Ewl_Widget *max;
 };
 
 Ewl_Widget *ewl_row_new();
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_tree.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_tree.c  2 Feb 2003 21:03:24 -0000       1.1
+++ ewl_tree.c  2 Feb 2003 23:07:23 -0000       1.2
@@ -200,6 +200,7 @@
        if (!node)
                DRETURN_PTR(NULL, DLEVEL_STABLE);
 
+       ZERO(node, Ewl_Tree_Node, 1);
        if (!ewl_tree_node_init(EWL_TREE_NODE(node))) {
                FREE(node);
                DRETURN_PTR(NULL, DLEVEL_STABLE);




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to