Enlightenment CVS committal

Author  : barbieri
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_calc.c edje_private.h edje_util.c 


Log Message:
Fix calculation of maximum values for swallow parts.

Due my last change, the code was broken by edjes without a group
min/max, this happens because edje_object_size_max_get() returns
100000 for these objects, and this was being used as object maximum
size.

Current fix is a hack: just check for this value, now known as
EDJE_INF_MAX_*, but the real solution would be to return 0 (or -1) and
check for it in other parts of the code, but it's harder to get right.


===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_calc.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -3 -r1.112 -r1.113
--- edje_calc.c 14 Oct 2007 23:54:27 -0000      1.112
+++ edje_calc.c 19 Oct 2007 19:31:42 -0000      1.113
@@ -259,19 +259,35 @@
      {
        minw = desc->min.w;
        if (ep->swallow_params.min.w > desc->min.w) minw = 
ep->swallow_params.min.w;
-       maxw = desc->max.w;
-       if (((ep->swallow_params.max.w >= 0) && (desc->max.w >= 0) &&
-            (ep->swallow_params.max.w < maxw)) ||
-           (ep->swallow_params.max.w >= 0)) maxw = ep->swallow_params.max.w;
+
+       /* XXX TODO: remove need of EDJE_INF_MAX_W, see edje_util.c */
+       if ((ep->swallow_params.max.w <= 0) ||
+           (ep->swallow_params.max.w == EDJE_INF_MAX_W))
+         maxw = desc->max.w;
+       else
+         {
+            if (desc->max.w <= 0)
+              maxw = ep->swallow_params.max.w;
+            else
+              maxw = MIN(ep->swallow_params.max.w, desc->max.w);
+         }
      }
 //   if (flags & FLAG_Y)
      {
        minh = desc->min.h;
        if (ep->swallow_params.min.h > desc->min.h) minh = 
ep->swallow_params.min.h;
-       maxh = desc->max.h;
-       if (((ep->swallow_params.max.h >= 0) && (desc->max.h >= 0) &&
-            (ep->swallow_params.max.h < maxh)) ||
-           (ep->swallow_params.max.h >= 0)) maxh = ep->swallow_params.max.h;
+
+       /* XXX TODO: remove need of EDJE_INF_MAX_H, see edje_util.c */
+       if ((ep->swallow_params.max.h <= 0) ||
+           (ep->swallow_params.max.h == EDJE_INF_MAX_H))
+         maxh = desc->max.h;
+       else
+         {
+            if (desc->max.h <= 0)
+              maxh = ep->swallow_params.max.h;
+            else
+              maxh = MIN(ep->swallow_params.max.h, desc->max.h);
+         }
      }
    /* relative coords of top left & bottom right */
    if (flags & FLAG_X)
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -3 -r1.134 -r1.135
--- edje_private.h      8 Sep 2007 18:21:57 -0000       1.134
+++ edje_private.h      19 Oct 2007 19:31:42 -0000      1.135
@@ -126,6 +126,9 @@
 
 #define PI 3.14159265358979323846
 
+#define EDJE_INF_MAX_W 100000
+#define EDJE_INF_MAX_H 100000
+
 #define EDJE_IMAGE_SOURCE_TYPE_NONE           0
 #define EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT 1
 #define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY   2
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -3 -r1.101 -r1.102
--- edje_util.c 19 Oct 2007 16:07:43 -0000      1.101
+++ edje_util.c 19 Oct 2007 19:31:42 -0000      1.102
@@ -1087,7 +1087,8 @@
      }
    if (ed->collection->prop.max.w == 0)
      {
-       if (maxw) *maxw = 100000;
+       /* XXX TODO: convert maxw to 0, fix things that break. */
+       if (maxw) *maxw = EDJE_INF_MAX_W;
      }
    else
      {
@@ -1095,7 +1096,8 @@
      }
    if (ed->collection->prop.max.h == 0)
      {
-       if (maxh) *maxh = 100000;
+       /* XXX TODO: convert maxh to 0, fix things that break. */
+       if (maxh) *maxh = EDJE_INF_MAX_H;
      }
    else
      {



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to