Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_grid.c 


Log Message:
Another fix to grid sizing and reseting by Christopher Klug.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_grid.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_grid.c  12 Jan 2006 18:21:18 -0000      1.9
+++ ewl_grid.c  27 Jan 2006 02:01:07 -0000      1.10
@@ -80,7 +80,6 @@
        g->cols = cols;
        g->rows = rows;
 
-       g->rchildren = NULL;
        g->homogeneous_h = FALSE;
        g->homogeneous_v = FALSE;
 
@@ -117,9 +116,7 @@
 
        w = EWL_WIDGET(g);
 
-       g->rchildren = EWL_CONTAINER(w)->children;
-       EWL_CONTAINER(w)->children = NULL;
-       EWL_CONTAINER(w)->children = ecore_list_new();
+       ewl_container_reset(EWL_CONTAINER(w));
 
        IF_FREE(g->col_size);
        IF_FREE(g->row_size);
@@ -484,16 +481,6 @@
 
        g = EWL_GRID(w);
 
-       /*
-        * first check if the grid has been reset
-        * if so, we need to destroy the old children
-        */
-       if (g->rchildren) {
-               while ((child = ecore_list_remove_first(g->rchildren)) != NULL)
-                       ewl_widget_destroy(child);
-               g->rchildren = NULL;
-       }
-
        ewl_grid_resize(g);
 
        c_x = CURRENT_X(EWL_OBJECT(w));
@@ -539,7 +526,7 @@
 {
        int             w_flag = 0, h_flag = 0;
        int             i, new_w = 0, new_h = 0;
-       int             left_over;
+       int             left_over, left_over2;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("g", g);
@@ -588,9 +575,15 @@
                left_over -= g->col_size[i].size;
        if (g->cols == 0)
                g->cols = 1;
-       while (left_over > 0) {
-               g->col_size[left_over % g->cols].size += 1;
-               left_over--;
+       while (left_over != 0) {
+               if (left_over > 0) {
+                       g->col_size[left_over % g->cols].size += 1;
+                       left_over--;
+               } else if (left_over < 0) {
+                       left_over2 = 0 - left_over;
+                       g->col_size[left_over2 % g->cols].size -= 1;
+                       left_over++;
+               }
        }
 
        left_over = g->grid_h;
@@ -598,9 +591,15 @@
                left_over -= g->row_size[i].size;
        if (g->rows == 0)
                g->rows = 1;
-       while (left_over > 0) {
-               g->row_size[left_over % g->rows].size += 1;
-               left_over--;
+       while (left_over != 0) {
+               if (left_over > 0) {
+                       g->row_size[left_over % g->rows].size += 1;
+                       left_over--;
+               } else if (left_over < 0) {
+                       left_over2 = 0 - left_over;
+                       g->row_size[left_over2 % g->rows].size -= 1;
+                       left_over++;
+               }
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -726,6 +725,8 @@
        g->grid_w = g_w; 
        g->grid_h = g_h;
        ewl_object_preferred_inner_size_set(EWL_OBJECT(g), g_w, g_h);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /*




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to