Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_container.c ewl_entry.c ewl_object.c ewl_widget.c 
        ewl_window.c 


Log Message:
Improved handling of minimum bit sizes. This does introduce a bug that can
cause widgets to grow their preferred sizes. I'll straighten this out asap.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- ewl_container.c     20 Feb 2003 05:17:40 -0000      1.29
+++ ewl_container.c     6 Mar 2003 01:14:40 -0000       1.30
@@ -305,9 +305,8 @@
         * Run the parents child resize function to allow it to update it's
         * preferred size.
         */
-       if (EWL_CONTAINER(w->parent)->child_resize)
-               EWL_CONTAINER(w->parent)->
-                   child_resize(EWL_CONTAINER(w->parent), w, size, o);
+       EWL_CONTAINER(w->parent)->child_resize(EWL_CONTAINER(w->parent),
+                       w, size, o);
 
        /*
         * Get the new preferred size of the parent to see if it changed.
@@ -321,6 +320,8 @@
         */
        if (w->parent->parent)
                ewl_widget_configure(w->parent->parent);
+       else
+               ewl_widget_configure(w->parent);
 }
 
 /**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- ewl_entry.c 3 Mar 2003 22:53:32 -0000       1.49
+++ ewl_entry.c 6 Mar 2003 01:14:41 -0000       1.50
@@ -179,8 +179,9 @@
                        ewl_object_get_preferred_w(EWL_OBJECT(e->text)),
                        ewl_object_get_preferred_h(EWL_OBJECT(e->text)));
 
-       str = EWL_TEXT(e->text)->text;
+       str = ewl_text_get_text(EWL_TEXT(e->text));
        c_spos = ewl_cursor_get_start_position(EWL_CURSOR(e->cursor));
+       c_epos = ewl_cursor_get_end_position(EWL_CURSOR(e->cursor));
 
        l = ewl_text_get_length(EWL_TEXT(e->text));
        if (str && l && c_spos > l) {
@@ -195,7 +196,6 @@
                ewl_text_get_letter_geometry(EWL_TEXT(e->text), --c_spos, &sx,
                                             &sy, NULL, NULL);
 
-               c_epos = ewl_cursor_get_end_position(EWL_CURSOR(e->cursor));
                ewl_text_get_letter_geometry(EWL_TEXT(e->text), --c_epos, &ex,
                                             &ey, &ew, &eh);
 
@@ -205,6 +205,8 @@
 
        ewl_object_request_geometry(EWL_OBJECT(e->cursor), xx, yy, ww, hh);
 
+       FREE(str);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -507,7 +509,7 @@
        ep = ewl_cursor_get_end_position(EWL_CURSOR(e->cursor));
 
        s = ewl_entry_get_text(EWL_ENTRY(w));
-       if (!strlen(s) || sp < 2) {
+       if (!strlen(s) || (sp == ep && sp < 2)) {
                FREE(s);
                DRETURN(DLEVEL_STABLE);
        }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_object.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- ewl_object.c        3 Mar 2003 18:14:22 -0000       1.30
+++ ewl_object.c        6 Mar 2003 01:14:41 -0000       1.31
@@ -170,7 +170,7 @@
  */
 void ewl_object_set_preferred_w(Ewl_Object * o, unsigned int w)
 {
-       int             old_size;
+       int             old_size, new_size;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
@@ -187,16 +187,18 @@
         */
        old_size = PREFERRED_W(o);
 
-       /*
-        * Set the current size to the new preferred size.
-        */
        PREFERRED_W(o) = w;
+       if (w < MINIMUM_W(o))
+               new_size = MINIMUM_W(o);
+       else if (w > MAXIMUM_W(o))
+               new_size = MAXIMUM_W(o);
+       else
+               new_size = w;
 
        /*
         * Now update the widgets parent of the change in size.
         */
-       ewl_container_resize_child(EWL_WIDGET(o),
-                                  PREFERRED_W(o) - old_size,
+       ewl_container_resize_child(EWL_WIDGET(o), new_size - old_size,
                                   EWL_ORIENTATION_HORIZONTAL);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -212,7 +214,7 @@
  */
 void ewl_object_set_preferred_h(Ewl_Object * o, unsigned int h)
 {
-       int             old_size;
+       int             old_size, new_size;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
@@ -229,16 +231,19 @@
         */
        old_size = PREFERRED_H(o);
 
-       /*
-        * Set the current size to the new preferred size
-        */
        PREFERRED_H(o) = h;
+       if (h < MINIMUM_H(o))
+               new_size = MINIMUM_H(o);
+       else if (h > MAXIMUM_H(o))
+               new_size = MAXIMUM_H(o);
+       else
+               new_size = h;
 
        /*
         * Notify the parent widgets of the change in size.
         */
        ewl_container_resize_child(EWL_WIDGET(o),
-                                  PREFERRED_H(o) - old_size,
+                                  new_size - old_size,
                                   EWL_ORIENTATION_VERTICAL);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -539,11 +544,8 @@
        if (MAXIMUM_W(o) < w)
                MAXIMUM_W(o) = w;
 
-       /*
-        * Notify the parent widgets of the change in size.
-        */
-       ewl_container_resize_child(EWL_WIDGET(o), 0,
-                                  EWL_ORIENTATION_HORIZONTAL);
+       if (PREFERRED_W(o) < MINIMUM_W(o))
+               ewl_object_set_preferred_w(EWL_WIDGET(o), PREFERRED_W(o));
 
        if (CURRENT_W(o) < w)
                ewl_object_request_w(o, w);
@@ -571,11 +573,8 @@
        if (MAXIMUM_H(o) < h)
                MAXIMUM_H(o) = h;
 
-       /*
-        * Notify the parent widgets of the change in size.
-        */
-       ewl_container_resize_child(EWL_WIDGET(o), 0,
-                                  EWL_ORIENTATION_VERTICAL);
+       if (PREFERRED_H(o) < MINIMUM_H(o))
+               ewl_object_set_preferred_h(EWL_WIDGET(o), PREFERRED_H(o));
 
        if (CURRENT_H(o) < h)
                ewl_object_request_h(o, h);
@@ -680,6 +679,9 @@
        if (MINIMUM_W(o) > w)
                MINIMUM_W(o) = w;
 
+       if (PREFERRED_W(o) > MAXIMUM_W(o))
+               ewl_object_set_preferred_w(EWL_WIDGET(o), PREFERRED_W(o));
+
        if (CURRENT_W(o) > w)
                ewl_object_request_h(o, w);
 
@@ -705,6 +707,9 @@
 
        if (MINIMUM_H(o) > h)
                o->minimum.h = h;
+
+       if (PREFERRED_H(o) > MAXIMUM_H(o))
+               ewl_object_set_preferred_h(EWL_WIDGET(o), PREFERRED_H(o));
 
        if (CURRENT_H(o) > h)
                ewl_object_request_h(o, h);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- ewl_widget.c        1 Mar 2003 18:34:46 -0000       1.46
+++ ewl_widget.c        6 Mar 2003 01:14:41 -0000       1.47
@@ -762,22 +762,16 @@
                 */
                ebits_get_min_size(w->ebits_object, &i_l, &i_t);
 
-               if (MINIMUM_W(w) == EWL_OBJECT_MIN_SIZE)
-                       ewl_object_set_minimum_w(EWL_OBJECT(w), i_l);
-
-               if (MINIMUM_H(w) == EWL_OBJECT_MIN_SIZE)
-                       ewl_object_set_minimum_h(EWL_OBJECT(w), i_t);
+               ewl_object_set_minimum_w(EWL_OBJECT(w), i_l);
+               ewl_object_set_minimum_h(EWL_OBJECT(w), i_t);
 
                /*
                 * Propagate maximum sizes from the bit theme to the widget.
                 */
                ebits_get_max_size(w->ebits_object, &i_l, &i_t);
 
-               if (MAXIMUM_W(w) == EWL_OBJECT_MAX_SIZE)
-                       ewl_object_set_maximum_w(EWL_OBJECT(w), i_l);
-
-               if (MAXIMUM_H(w) == EWL_OBJECT_MAX_SIZE)
-                       ewl_object_set_maximum_h(EWL_OBJECT(w), i_t);
+               ewl_object_set_maximum_w(EWL_OBJECT(w), i_l);
+               ewl_object_set_maximum_h(EWL_OBJECT(w), i_t);
        }
 
        DRETURN(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- ewl_window.c        26 Feb 2003 01:15:24 -0000      1.43
+++ ewl_window.c        6 Mar 2003 01:14:41 -0000       1.44
@@ -59,7 +59,7 @@
 
        ewd_list_goto_first(ewl_window_list);
 
-       while ((retwin = ewd_list_next(ewl_window_list)) != NULL)
+       while ((retwin = ewd_list_next(ewl_window_list)))
                if (retwin->window == window)
                        DRETURN_PTR(retwin, DLEVEL_STABLE);
 
@@ -565,6 +565,7 @@
 {
        Ewl_Window     *win;
        Ewl_Object     *child;
+       int             width, height;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
@@ -586,24 +587,22 @@
                 * they've already been accounted for.
                 */
                ewl_object_request_size(child,
-                                       CURRENT_W(w) - (CURRENT_X(child)),
-                                       CURRENT_H(w) - (CURRENT_Y(child)));
+                                       CURRENT_W(w) -
+                                       ewl_object_get_current_x(child),
+                                       CURRENT_H(w) -
+                                       ewl_object_get_current_y(child));
        }
 
-       ecore_window_resize(win->window,
-                       ewl_object_get_current_w(EWL_OBJECT(w)),
-                       ewl_object_get_current_h(EWL_OBJECT(w)));
-       ecore_window_resize(win->evas_window,
-                       ewl_object_get_current_w(EWL_OBJECT(w)),
-                       ewl_object_get_current_h(EWL_OBJECT(w)));
-       evas_output_size_set(win->evas,
-                       ewl_object_get_current_w(EWL_OBJECT(w)),
-                       ewl_object_get_current_h(EWL_OBJECT(w)));
+       width = ewl_object_get_current_w(EWL_OBJECT(w));
+       height = ewl_object_get_current_h(EWL_OBJECT(w));
+
+       ecore_window_resize(win->window, width, height);
+       ecore_window_resize(win->evas_window, width, height);
+       evas_output_size_set(win->evas, width, height);
        evas_output_viewport_set(win->evas,
                        ewl_object_get_current_x(EWL_OBJECT(w)),
                        ewl_object_get_current_y(EWL_OBJECT(w)),
-                       ewl_object_get_current_w(EWL_OBJECT(w)),
-                       ewl_object_get_current_h(EWL_OBJECT(w)));
+                       width, height);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }




-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to