Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_box.c ewl_container.c ewl_entry.c ewl_entry.h ewl_misc.c 
        ewl_misc.h ewl_notebook.c ewl_overlay.c ewl_paned.c ewl_row.c 
        ewl_widget.c ewl_window.c 


Log Message:
Fix incorrect top level flag on overlay.
Rearrange show/hide/resize notifications.
Change the way insets and padding are set to prevent widgets growing on
remove/add.
Use no fill policy on the notebook tab box in order to allow alignment.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_box.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- ewl_box.c   14 Dec 2004 00:33:17 -0000      1.75
+++ ewl_box.c   24 Dec 2004 22:16:40 -0000      1.76
@@ -1,4 +1,3 @@
-
 #include <Ewl.h>
 
 typedef struct
@@ -114,11 +113,9 @@
                        DRETURN_INT(FALSE, DLEVEL_STABLE);
        }
 
-       ewl_container_add_notify_set(EWL_CONTAINER(b), ewl_box_child_add_cb);
-       ewl_container_remove_notify_set(EWL_CONTAINER(b), 
ewl_box_child_remove_cb);
        ewl_container_resize_notify_set(EWL_CONTAINER(b), 
ewl_box_child_resize_cb);
        ewl_container_show_notify_set(EWL_CONTAINER(b), ewl_box_child_show_cb);
-       ewl_container_hide_notify_set(EWL_CONTAINER(b), ewl_box_child_hide_cb);
+       ewl_container_hide_notify_set(EWL_CONTAINER(b), ewl_box_child_show_cb);
 
        ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, ewl_box_configure_cb,
                        NULL);
@@ -234,7 +231,7 @@
                ewl_container_show_notify_set(EWL_CONTAINER(b),
                                          ewl_box_child_show_cb);
                ewl_container_hide_notify_set(EWL_CONTAINER(b),
-                                         ewl_box_child_hide_cb);
+                                         ewl_box_child_show_cb);
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -659,43 +656,37 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-void
-ewl_box_child_add_cb(Ewl_Container * c, Ewl_Widget * w)
-{
-}
-
-void
-ewl_box_child_remove_cb(Ewl_Container * c, Ewl_Widget * w)
-{
-}
-
 /*
  * When a child gets added to the box update it's size.
  */
 void
 ewl_box_child_show_cb(Ewl_Container * c, Ewl_Widget * w)
 {
-       int size, space = 0;
+       int nodes, space = 0;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       if (ecore_list_nodes(c->children) > 1)
-               space = EWL_BOX(c)->spacing;
+       nodes = ecore_list_nodes(c->children) - 1;
+       if (nodes < 0)
+               nodes = 0;
+       space = EWL_BOX(c)->spacing * nodes;
 
        /*
         * Base the info used on the orientation of the box.
         */
        if (EWL_BOX(c)->orientation == EWL_ORIENTATION_HORIZONTAL) {
-               size = PREFERRED_W(c) +
-                       ewl_object_preferred_w_get(EWL_OBJECT(w)) + space;
-               ewl_object_preferred_inner_w_set(EWL_OBJECT(c), size);
+               int width;
+               ewl_container_sum_prefer(c, EWL_ORIENTATION_HORIZONTAL);
                ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
+               width = ewl_object_preferred_inner_w_get(EWL_OBJECT(c));
+               ewl_object_preferred_inner_w_set(EWL_OBJECT(c), width + space);
        }
        else {
-               size = PREFERRED_H(c) +
-                       ewl_object_preferred_h_get(EWL_OBJECT(w)) + space;
-               ewl_object_preferred_inner_h_set(EWL_OBJECT(c), size);
+               int height;
+               ewl_container_sum_prefer(c, EWL_ORIENTATION_VERTICAL);
                ewl_container_largest_prefer(c, EWL_ORIENTATION_HORIZONTAL);
+               height = ewl_object_preferred_inner_h_get(EWL_OBJECT(c));
+               ewl_object_preferred_inner_h_set(EWL_OBJECT(c), height + space);
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -743,7 +734,6 @@
                                PREFERRED_W(c) -
                                ewl_object_preferred_w_get(EWL_OBJECT(w)) -
                                space);
-
                ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
        }
        else {
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -3 -r1.81 -r1.82
--- ewl_container.c     9 Dec 2004 05:26:09 -0000       1.81
+++ ewl_container.c     24 Dec 2004 22:16:41 -0000      1.82
@@ -164,7 +164,7 @@
        DCHECK_PARAM_PTR("pc", pc);
        DCHECK_PARAM_PTR("child", child);
 
-       if (pc == child->parent)
+       if (pc == EWL_CONTAINER(child->parent))
                DRETURN(DLEVEL_STABLE);
 
        if (ewl_container_parent_of(child, EWL_WIDGET(pc))) {
@@ -197,7 +197,7 @@
        DCHECK_PARAM_PTR("pc", pc);
        DCHECK_PARAM_PTR("child", child);
 
-       if (pc == child->parent)
+       if (pc == EWL_CONTAINER(child->parent))
                DRETURN(DLEVEL_STABLE);
 
        if (ewl_container_parent_of(child, EWL_WIDGET(pc))) {
@@ -233,7 +233,7 @@
        DCHECK_PARAM_PTR("pc", pc);
        DCHECK_PARAM_PTR("child", child);
 
-       if (pc == child->parent)
+       if (pc == EWL_CONTAINER(child->parent))
                DRETURN(DLEVEL_STABLE);
 
        if (ewl_container_parent_of(child, EWL_WIDGET(pc))) {
@@ -327,8 +327,8 @@
 
        DCHECK_PARAM_PTR("w", w);
 
-       if (!size || ewl_object_queued_has(EWL_OBJECT(w),
-                               EWL_FLAG_QUEUED_RSCHEDULED) || !REALIZED(w))
+       if (!size || !REALIZED(w) || ewl_object_queued_has(EWL_OBJECT(w),
+                                               EWL_FLAG_QUEUED_RSCHEDULED))
                DRETURN(DLEVEL_STABLE);
 
        c = EWL_CONTAINER(w->parent);
@@ -1008,6 +1008,7 @@
 void ewl_container_unrealize_cb(Ewl_Widget *w, void *ev_data, void *user_data)
 {
        Ewl_Container *c;
+       Ewl_Widget *child;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
 
@@ -1021,5 +1022,16 @@
                c->clip_box = NULL;
        }
 
+       /*
+        * FIXME: If called from a destroy callback, the child list may not
+        * exist at this point. Is this legitimate ordering?
+        */
+       if (c->children) {
+               ecore_list_goto_first(c->children);
+               while ((child = ecore_list_next(c->children))) {
+                       ewl_widget_unrealize(child);
+               }
+       }
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -3 -r1.122 -r1.123
--- ewl_entry.c 21 Dec 2004 01:21:33 -0000      1.122
+++ ewl_entry.c 24 Dec 2004 22:16:41 -0000      1.123
@@ -6,6 +6,7 @@
  * Private functions for applying operations to the text at realize time.
  */
 static void ewl_entry_ops_apply(Ewl_Entry *e);
+static void ewl_entry_ops_reset(Ewl_Entry *e);
 static void ewl_entry_op_prune_list(Ewl_Entry *e, int rstart, int rend, 
                                    int bstart, int bend);
 static void ewl_entry_op_free(void *data);
@@ -105,11 +106,6 @@
        e->in_select_mode = FALSE;
        e->multiline = FALSE;
 
-       ewl_container_show_notify_set(EWL_CONTAINER(w),
-                                     ewl_entry_child_show_cb);
-       ewl_container_resize_notify_set(EWL_CONTAINER(w),
-                                       ewl_entry_child_resize_cb);
-
        ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_HSHRINK |
                                   EWL_FLAG_FILL_HFILL);
        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_SELECT);
@@ -147,6 +143,10 @@
                            NULL);
        ewl_callback_append(w, EWL_CALLBACK_UNREALIZE, ewl_entry_unrealize_cb,
                            NULL);
+       ewl_callback_append(w, EWL_CALLBACK_SHOW, ewl_entry_show_cb,
+                           NULL);
+       ewl_callback_append(w, EWL_CALLBACK_HIDE, ewl_entry_hide_cb,
+                           NULL);
        ewl_callback_append(w, EWL_CALLBACK_DESTROY, ewl_entry_destroy_cb,
                            NULL);
        ewl_callback_append(w, EWL_CALLBACK_REPARENT, ewl_entry_reparent_cb,
@@ -747,7 +747,7 @@
        if (!ch)
                ch = CURRENT_H(e->cursor);
 
-       printf("Map %d(%d) of %d to %d, %d: %d x %d\n", pos, c_pos, l, cx, cy, 
cw, ch);
+       /* printf("Map %d(%d) of %d to %d, %d: %d x %d\n", pos, c_pos, l, cx, 
cy, cw, ch); */
        ewl_object_geometry_request(EWL_OBJECT(e->cursor), cx, cy, 
                                    cw, ch);
 }
@@ -768,13 +768,20 @@
         * Find the embed so we know which evas to draw onto.
         */
        emb = ewl_embed_widget_find(w);
+       if (!emb)
+               DRETURN(DLEVEL_STABLE);
 
        /*
-        * Create the etox
+        * Create the etox and save the context for future reference.
         */
        e->etox = etox_new(emb->evas);
        e->context = etox_get_context(e->etox);
 
+       /*
+        * Apply the default theme information to the context, this
+        * information may be altered programmatically through the operation
+        * queues.
+        */
        tmp = ewl_theme_data_str_get(w, "font");
        etox_context_set_font(e->context, tmp,
                              ewl_theme_data_int_get(w, "font_size"));
@@ -792,8 +799,6 @@
 
        if (w->fx_clip_box)
                evas_object_clip_set(e->etox, w->fx_clip_box);
-
-       evas_object_show(e->etox);
        ewl_entry_ops_apply(e);
 
        /*
@@ -813,8 +818,39 @@
 
        e = EWL_ENTRY(w);
 
+       /*
+        * Reset the text to initial state in order to recreate the operations
+        * if it is re-realized.
+        */
+       ewl_entry_ops_reset(e);
        evas_object_clip_unset(e->etox);
        evas_object_del(e->etox);
+       e->etox = NULL;
+       e->context = NULL;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void ewl_entry_show_cb(Ewl_Widget *w, void *ev_data, void *user_data)
+{
+       Ewl_Entry   *e;
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       e = EWL_ENTRY(w);
+
+       evas_object_show(e->etox);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void ewl_entry_hide_cb(Ewl_Widget *w, void *ev_data, void *user_data)
+{
+       Ewl_Entry   *e;
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       e = EWL_ENTRY(w);
+
+       evas_object_hide(e->etox);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -1362,47 +1398,6 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-void
-ewl_entry_child_show_cb(Ewl_Container * c, Ewl_Widget * w)
-{
-       Ewl_Entry *e;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-
-       e = EWL_ENTRY(c);
-
-/*     if (e->text == w) {
-               ewl_object_preferred_inner_size_set(EWL_OBJECT(c),
-                          ewl_object_preferred_w_get(EWL_OBJECT(w)),
-                          ewl_object_preferred_h_get(EWL_OBJECT(w)));
-       }
-*/
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-void
-ewl_entry_child_resize_cb(Ewl_Container * entry, Ewl_Widget * w, int size,
-                         Ewl_Orientation o)
-{
-/*     Ewl_Object *text;
-*/
-       DENTER_FUNCTION(DLEVEL_STABLE);
-/*
-       text = EWL_OBJECT(EWL_ENTRY(entry)->text);
-
-       if (w != EWL_WIDGET(text))
-               DRETURN(DLEVEL_STABLE);
-
-       if (o == EWL_ORIENTATION_HORIZONTAL)
-               ewl_object_preferred_inner_w_set(EWL_OBJECT(entry),
-                          ewl_object_preferred_w_get(text));
-       else
-               ewl_object_preferred_inner_h_set(EWL_OBJECT(entry),
-                          ewl_object_preferred_h_get(text));
-*/
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
 static int ewl_entry_timer(void *data)
 {
        Ewl_Entry      *e;
@@ -1628,6 +1623,16 @@
        }
 }
 
+static void ewl_entry_ops_reset(Ewl_Entry *e)
+{
+       Ewl_Entry_Op *op;
+
+       while ((op = ecore_dlist_remove_first(e->applied))) {
+               op->apply(e, op);
+               ecore_dlist_append(e->ops, op);
+       }
+}
+
 static void ewl_entry_op_free(void *data)
 {
        Ewl_Entry_Op *op = data;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- ewl_entry.h 21 Dec 2004 01:18:11 -0000      1.46
+++ ewl_entry.h 24 Dec 2004 22:16:41 -0000      1.47
@@ -240,12 +240,11 @@
 
 void ewl_entry_update_selected_region_cb(Ewl_Widget * w, void *user_data,
                                         void *ev_data);
-void ewl_entry_child_show_cb(Ewl_Container * c, Ewl_Widget * w);
-void ewl_entry_child_resize_cb(Ewl_Container * entry, Ewl_Widget * text,
-                              int size, Ewl_Orientation o);
 
 void ewl_entry_realize_cb(Ewl_Widget * w, void *ev_data, void *user_data);
 void ewl_entry_unrealize_cb(Ewl_Widget * w, void *ev_data, void *user_data);
+void ewl_entry_show_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_entry_hide_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_entry_destroy_cb(Ewl_Widget * w, void *ev_data, void *user_data);
 void ewl_entry_reparent_cb(Ewl_Widget * w, void *ev_data, void *user_data);
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_misc.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -3 -r1.86 -r1.87
--- ewl_misc.c  8 Dec 2004 04:16:32 -0000       1.86
+++ ewl_misc.c  24 Dec 2004 22:16:41 -0000      1.87
@@ -147,6 +147,7 @@
                ewl_shutdown();
                DRETURN_INT(_ewl_init_count, DLEVEL_STABLE);
        }
+
        if (print_theme_keys)
                ewl_config.theme.print_keys = print_theme_keys;
 
@@ -265,7 +266,9 @@
         * unnecessary work done from configuration. Then display new widgets,
         * finally layout the widgets.
         */
-       if (!ecore_list_is_empty(destroy_list))
+       if (!ecore_list_is_empty(destroy_list) ||
+                       !ecore_list_is_empty(free_evas_list) ||
+                       !ecore_list_is_empty(free_evas_object_list))
                ewl_garbage_collect();
 
        if (!ecore_list_is_empty(realize_list))
@@ -640,6 +643,25 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+/**
+ * @param w: the widget that no longer needs to be realized
+ * @return Returns no value.
+ * @brief Cancel a request to realize a widget
+ *
+ * Remove the widget @w from the list of widgets that need to be realized.
+ */
+void ewl_realize_cancel_request(Ewl_Widget *w)
+{
+       DENTER_FUNCTION(DLEVEL_TESTING);
+
+       ecore_list_goto(realize_list, w);
+
+       if (ecore_list_current(realize_list) == w)
+               ecore_list_remove(realize_list);
+
+       DLEAVE_FUNCTION(DLEVEL_TESTING);
+}
+
 void ewl_realize_queue()
 {
        Ewl_Widget *w;
@@ -671,7 +693,7 @@
                 * Check visibility in case the realize callback changed it.
                 */
                if (VISIBLE(w))
-                       ewl_widget_show(w);
+                       ewl_callback_call(w, EWL_CALLBACK_SHOW);
                ewl_object_queued_remove(EWL_OBJECT(w),
                                         EWL_FLAG_QUEUED_RSCHEDULED);
        }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_misc.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ewl_misc.h  23 Aug 2004 00:42:12 -0000      1.28
+++ ewl_misc.h  24 Dec 2004 22:16:41 -0000      1.29
@@ -23,6 +23,7 @@
 void            ewl_configure_queue(void);
 void            ewl_configure_cancel_request(Ewl_Widget *w);
 void            ewl_realize_request(Ewl_Widget *w);
+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);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_notebook.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- ewl_notebook.c      9 Dec 2004 05:26:09 -0000       1.55
+++ ewl_notebook.c      24 Dec 2004 22:16:41 -0000      1.56
@@ -58,6 +58,7 @@
        if (!n->tab_box) {
                DRETURN_INT(FALSE, DLEVEL_STABLE);
        }
+       ewl_object_fill_policy_set(EWL_OBJECT(n->tab_box), EWL_FLAG_FILL_NONE);
        ewl_widget_internal_set(n->tab_box, TRUE);
        ewl_widget_appearance_set(n->tab_box, "tab_box");
        ewl_widget_show(n->tab_box);
@@ -360,8 +361,10 @@
                                EWL_ORIENTATION_HORIZONTAL);
                        ewl_box_orientation_set(EWL_BOX(n->tab_box),
                                EWL_ORIENTATION_VERTICAL);
+                       /*
                        ewl_object_fill_policy_set(EWL_OBJECT(n->tab_box),
                                EWL_FLAG_FILL_HSHRINK | EWL_FLAG_FILL_VFILL);
+                               */
                        break;
 
                case EWL_POSITION_TOP:
@@ -371,8 +374,10 @@
                                EWL_ORIENTATION_VERTICAL);
                        ewl_box_orientation_set(EWL_BOX(n->tab_box),
                                EWL_ORIENTATION_HORIZONTAL);
+                       /*
                        ewl_object_fill_policy_set(EWL_OBJECT(n->tab_box),
                                EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_VSHRINK);
+                       */
                        break;
        }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_overlay.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_overlay.c       9 Dec 2004 05:26:09 -0000       1.9
+++ ewl_overlay.c       24 Dec 2004 22:16:41 -0000      1.10
@@ -47,7 +47,6 @@
                                    ewl_overlay_child_resize_cb);
 
        ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_NONE);
-       ewl_object_toplevel_set(EWL_OBJECT(w), EWL_FLAG_PROPERTY_TOPLEVEL);
 
        /*
         * Override the default configure callbacks since the overlay
@@ -74,7 +73,7 @@
        ecore_list_goto_first(EWL_CONTAINER(w)->children);
        while ((child = ecore_list_next(EWL_CONTAINER(w)->children))) {
                /*
-                * Try to give the child the full size of the window from it's
+                * Try to give the child the full size of the overlay from it's
                 * base position. The object will constrict it based on the
                 * fill policy. Don't add the TOP and LEFT insets since
                 * they've already been accounted for.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_paned.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ewl_paned.c 9 Dec 2004 05:26:09 -0000       1.6
+++ ewl_paned.c 24 Dec 2004 22:16:41 -0000      1.7
@@ -59,7 +59,7 @@
 
        p->first = EWL_BOX(ewl_vbox_new());
        ewl_container_child_append(EWL_CONTAINER(p), EWL_WIDGET(p->first));
-       ewl_object_fill_policy_set(EWL_OBJECT(p->first), EWL_FLAG_FILL_NONE);
+       ewl_object_fill_policy_set(EWL_OBJECT(p->first), EWL_FLAG_FILL_ALL);
        ewl_widget_show(EWL_WIDGET(p->first));
 
        if (orient == EWL_ORIENTATION_HORIZONTAL)
@@ -83,7 +83,7 @@
 
        p->second = EWL_BOX(ewl_vbox_new());
        ewl_container_child_append(EWL_CONTAINER(p), EWL_WIDGET(p->second));
-       ewl_object_fill_policy_set(EWL_OBJECT(p->second), EWL_FLAG_FILL_NONE);
+       ewl_object_fill_policy_set(EWL_OBJECT(p->second), EWL_FLAG_FILL_ALL);
        ewl_widget_show(EWL_WIDGET(p->second));
     
        ewl_widget_internal_set(EWL_WIDGET(p->first), TRUE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_row.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- ewl_row.c   9 Dec 2004 05:26:09 -0000       1.34
+++ ewl_row.c   24 Dec 2004 22:16:41 -0000      1.35
@@ -32,7 +32,6 @@
 int ewl_row_init(Ewl_Row *row)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-
        DCHECK_PARAM_PTR_RET("row", row, FALSE);
 
        if (!ewl_container_init(EWL_CONTAINER(row), "row"))
@@ -66,7 +65,6 @@
 ewl_row_header_set(Ewl_Row *row, Ewl_Row *header)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
-
        DCHECK_PARAM_PTR("row", row);
 
        if (row->header == header)
@@ -111,7 +109,6 @@
        Ewl_Widget *found;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
-
        DCHECK_PARAM_PTR_RET("row", row, NULL);
 
        found = ecore_list_goto_index(EWL_CONTAINER(row)->children, n + 1);
@@ -209,7 +206,11 @@
 void
 ewl_row_destroy_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
        ewl_row_header_set(EWL_ROW(w), NULL);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 void
@@ -217,9 +218,13 @@
 {
        Ewl_Row *row;
 
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
        row = EWL_ROW(user_data);
        ewl_object_preferred_inner_w_set(EWL_OBJECT(w), CURRENT_W(row->header));
        ewl_widget_configure(EWL_WIDGET(row));
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 void
@@ -227,9 +232,13 @@
 {
        Ewl_Row *row;
 
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
        row = EWL_ROW(user_data);
        row->header = NULL;
        ewl_row_header_set(row, NULL);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 void
@@ -237,11 +246,15 @@
 {
        Ewl_Row *row;
 
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
        row = EWL_ROW(c);
 
        ewl_container_largest_prefer(c, EWL_ORIENTATION_VERTICAL);
        ewl_object_preferred_inner_w_set(EWL_OBJECT(c), PREFERRED_W(c) +
                        ewl_object_preferred_w_get(EWL_OBJECT(w)));
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -3 -r1.129 -r1.130
--- ewl_widget.c        22 Dec 2004 23:15:38 -0000      1.129
+++ ewl_widget.c        24 Dec 2004 22:16:41 -0000      1.130
@@ -12,6 +12,32 @@
                                        int *t, int *b);
 
 /**
+ * @param appearance: the base theme appearance string for the widget
+ * @brief Allocate a new widget with the specified appearance string
+ * @return Returns a newly allocated widget on success, NULL on failure.
+ *
+ * Do not use this function unless you know what you are doing! It is only
+ * intended to easily create custom widgets that are not containers.
+ */
+Ewl_Widget *ewl_widget_new(char *appearance)
+{
+       Ewl_Widget *w;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("appearance", appearance, NULL);
+
+       w = NEW(Ewl_Widget, 1);
+       if (w) {
+               if (!ewl_widget_init(w, appearance)) {
+                       FREE(w);
+                       w = NULL;
+               }
+       }
+
+       DRETURN_PTR(w, DLEVEL_STABLE);
+}
+
+/**
  * @param w: the widget to initialize
  * @param appearance: the key for the widgets theme appearance
  * @return Returns TRUE on success, FALSE on failure.
@@ -93,6 +119,9 @@
        if (REALIZED(w))
                DRETURN(DLEVEL_STABLE);
 
+       if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_RSCHEDULED))
+               ewl_realize_cancel_request(w);
+
        /*
         * The parent's realize function will get us here again.
         */
@@ -100,16 +129,11 @@
                ewl_widget_realize(w->parent);
        else if (w->parent || ewl_object_toplevel_get(EWL_OBJECT(w))) {
                ewl_callback_call(w, EWL_CALLBACK_REALIZE);
+               ewl_object_visible_add(EWL_OBJECT(w),
+                                      EWL_FLAG_VISIBLE_REALIZED);
        }
 
-       /*
-        * If somehow the child doesn't cause the parent to get a configure
-        * request, this will catch it.
-        */
-       if (w->parent)
-               ewl_widget_configure(w->parent);
-       else
-               ewl_widget_configure(w);
+       ewl_widget_show(w);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -126,11 +150,13 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
+       if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_RSCHEDULED))
+               ewl_realize_cancel_request(w);
+
        if (!REALIZED(w))
                DRETURN(DLEVEL_STABLE);
 
        ewl_callback_call(w, EWL_CALLBACK_UNREALIZE);
-
        ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_REALIZED);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -142,42 +168,33 @@
  * @brief mark a widget as visible
  *
  * Marks the widget as visible so that it will be displayed the next time
- * through the rendering loop.
+ * through the rendering loop. Note that the show callback may be delayed
+ * until the widget has been realized.
  */
 void ewl_widget_show(Ewl_Widget * w)
 {
-       Ewl_Container *pc;
-       unsigned int flags = 0;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
-       pc = EWL_CONTAINER(w->parent);
-       if (HIDDEN(w))
-               ewl_object_visible_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_SHOWN);
+       /*
+        * Nothing to do if already visible.
+        */
+       if (VISIBLE(w))
+               DRETURN(DLEVEL_STABLE);
 
-       if (REALIZED(w)) {
-               ewl_callback_call(w, EWL_CALLBACK_SHOW);
-               if (w->parent)
-                       ewl_container_child_show_call(EWL_CONTAINER(w->parent),
-                                                     w);
-       }
-       else if (pc) {
-               flags = ewl_object_flags_get(EWL_OBJECT(pc),
-                                            EWL_FLAG_QUEUED_RSCHEDULED |
-                                            EWL_FLAG_VISIBLE_REALIZED);
-       }
-       else {
-               flags = ewl_object_flags_get(EWL_OBJECT(w),
-                                            EWL_FLAG_PROPERTY_TOPLEVEL);
-       }
+       /*
+        * Flag that this is a visible widget
+        */
+       ewl_object_visible_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_SHOWN);
 
-       if (flags)
+       /*
+        * If realized, go about our business, otherwise queue for realize.
+        */
+       if (REALIZED(w))
+               ewl_callback_call(w, EWL_CALLBACK_SHOW);
+       else
                ewl_realize_request(w);
 
-       if (w->parent)
-               ewl_widget_configure(w->parent);
-
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -192,23 +209,19 @@
  */
 void ewl_widget_hide(Ewl_Widget * w)
 {
-       Ewl_Container *pc;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
+       /*
+        * Already hidden? Then no work to be done.
+        */
        if (HIDDEN(w))
                DRETURN(DLEVEL_STABLE);
 
-       pc = EWL_CONTAINER(w->parent);
-       if (pc)
-               ewl_container_child_hide_call(pc, w);
-
        ewl_object_visible_remove(EWL_OBJECT(w), EWL_FLAG_VISIBLE_SHOWN);
-       ewl_callback_call(w, EWL_CALLBACK_HIDE);
 
-       if (w->parent)
-               ewl_widget_configure(w->parent);
+       if (REALIZED(w))
+               ewl_callback_call(w, EWL_CALLBACK_HIDE);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -229,23 +242,7 @@
        if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_DSCHEDULED))
                DRETURN(DLEVEL_STABLE);
 
-       if (last_selected == w)
-               last_selected = NULL;
-
-       if (last_key == w)
-               last_key = NULL;
-
-       if (last_focused == w)
-               last_focused = NULL;
-
-       if (dnd_widget == w)
-               dnd_widget = NULL;
-
        ewl_widget_hide(w);
-
-       if (w->parent)
-               ewl_container_child_remove(EWL_CONTAINER(w->parent), w);
-
        ewl_destroy_request(w);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -512,6 +509,10 @@
                tmp = tmp->parent;
        }
 
+       /*
+        * Set this to the new parent here to avoid infinite recursion when
+        * called from ewl_container_child_remove.
+        */
        w->parent = p;
 
        /*
@@ -524,30 +525,16 @@
                        ewl_callback_del(w, EWL_CALLBACK_DESTROY,
                                 ewl_widget_child_destroy_cb);
        }
-
        /*
         * A widget that has not had a previous parent needs the parent
         * destruction callback added.
         */
-       if (p) {
-               if (!op)
-                       ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
-                                       ewl_widget_child_destroy_cb, NULL);
-               if (VISIBLE(w)) {
-                       if (REALIZED(w)) {
-                               ewl_container_child_show_call(EWL_CONTAINER(p),
-                                                            w);
-                       }
-                       else {
-                               ewl_realize_request(w);
-                       }
-               }
-
-               ewl_widget_configure(p);
+       else if (p) {
+               ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
+                                    ewl_widget_child_destroy_cb, NULL);
        }
 
-       if (op)
-               ewl_callback_call_with_event_data(w, EWL_CALLBACK_REPARENT, p);
+       ewl_callback_call_with_event_data(w, EWL_CALLBACK_REPARENT, p);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -564,9 +551,7 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
-       if (!ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED))
-               return;
-       else {
+       if (ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED)) {
                ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
                ewl_object_state_add(EWL_OBJECT(w), EWL_FLAG_STATE_NORMAL);
                ewl_callback_call(w, EWL_CALLBACK_WIDGET_ENABLE);
@@ -587,9 +572,7 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
-       if (ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED))
-               return;
-       else {
+       if (!ewl_object_state_has(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED)) {
                ewl_object_state_remove(EWL_OBJECT(w), EWL_FLAGS_STATE_MASK);
                ewl_object_state_add(EWL_OBJECT(w), EWL_FLAG_STATE_DISABLED);
                ewl_callback_call(w, EWL_CALLBACK_WIDGET_DISABLE);
@@ -947,6 +930,8 @@
  */
 void ewl_widget_show_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
+       Ewl_Container *pc;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
@@ -955,6 +940,10 @@
        if (w->theme_object)
                evas_object_show(w->theme_object);
 
+       pc = EWL_CONTAINER(w->parent);
+       if (pc)
+               ewl_container_child_show_call(pc, w);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -963,14 +952,44 @@
  */
 void ewl_widget_hide_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
+       Ewl_Container *pc;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
+       /*
+        * Hide the visible evas objects.
+        */
        if (w->fx_clip_box)
                evas_object_hide(w->fx_clip_box);
        if (w->theme_object)
                evas_object_hide(w->theme_object);
 
+       if (ewl_object_queued_has(EWL_OBJECT(w), EWL_FLAG_QUEUED_RSCHEDULED))
+               ewl_realize_cancel_request(w);
+
+       /*
+        * Notify parent of hidden state.
+        */
+       pc = EWL_CONTAINER(w->parent);
+       if (pc)
+               ewl_container_child_hide_call(pc, w);
+
+       /*
+        * Cleanup a variety of references to that can be held.
+        */
+       if (last_selected == w)
+               last_selected = NULL;
+
+       if (last_key == w)
+               last_key = NULL;
+
+       if (last_focused == w)
+               last_focused = NULL;
+
+       if (dnd_widget == w)
+               dnd_widget = NULL;
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -1019,29 +1038,6 @@
                evas_object_clip_set(w->fx_clip_box, pc->clip_box);
 
        /*
-        * Get and save the current insets and padding of the widget, this
-        * will be used to calculate any added at runtime.
-        */
-       if (w->theme_object) {
-               ewl_widget_theme_insets_get(w, &i_l, &i_r, &i_t, &i_b);
-               ewl_widget_theme_padding_get(w, &p_l, &p_r, &p_t, &p_b);
-       }
-
-       ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
-
-       i_l = l - i_l;
-       i_r = r - i_r;
-       i_t = t - i_t;
-       i_b = b - i_b;
-
-       ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
-
-       p_l = l - p_l;
-       p_r = r - p_r;
-       p_t = t - p_t;
-       p_b = b - p_b;
-
-       /*
         * Retrieve the path to the theme file that will be loaded
         * return if no file to be loaded. Also get the group name in the
         * theme file.
@@ -1076,6 +1072,37 @@
                if (w->bit_state)
                        edje_object_signal_emit(w->theme_object, w->bit_state, 
"EWL");
 
+               ewl_widget_theme_insets_get(w, &i_l, &i_r, &i_t, &i_b);
+               ewl_widget_theme_padding_get(w, &p_l, &p_r, &p_t, &p_b);
+
+               ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
+
+               /*
+                * Use previously set insets and padding if available.
+                */
+               if (l)
+                       i_l = l;
+               if (r)
+                       i_r = r;
+               if (t)
+                       i_t = t;
+               if (b)
+                       i_b = b;
+
+               ewl_object_padding_get(EWL_OBJECT(w), &l, &r, &t, &b);
+
+               if (l)
+                       p_l = l;
+               if (r)
+                       p_r = r;
+               if (t)
+                       p_t = t;
+               if (b)
+                       p_b = b;
+
+               /*
+                * Determine the evas layer for the objects and set clipping.
+                */
                evas_object_layer_set(w->theme_object,
                                ewl_widget_layer_sum_get(w));
                if (w->fx_clip_box)
@@ -1083,16 +1110,10 @@
                evas_object_show(w->theme_object);
 
                /*
-                * Set the insets based on cached information from the
-                * ebit, this can be overwritten later.
+                * Assign the relevant insets and padding.
                 */
-               ewl_widget_theme_insets_get(w, &l, &r, &t, &b);
-               ewl_object_insets_set(EWL_OBJECT(w), l + i_l, r + i_r, t + i_t,
-                               b + i_b);
-
-               ewl_widget_theme_padding_get(w, &l, &r, &t, &b);
-               ewl_object_padding_set(EWL_OBJECT(w), l + p_l, r + p_r, t + p_t,
-                               b + p_b);
+               ewl_object_insets_set(EWL_OBJECT(w), i_l, i_r, i_t, i_b);
+               ewl_object_padding_set(EWL_OBJECT(w), p_l, p_r, p_t, p_b);
 
                if (ewl_object_state_has(EWL_OBJECT(w),
                                        EWL_FLAG_STATE_DISABLED))
@@ -1107,11 +1128,13 @@
                i_t = (int)(height);
 
                if (i_l > 0 && MINIMUM_W(w) == EWL_OBJECT_MIN_SIZE
-                               && i_l > EWL_OBJECT_MIN_SIZE && i_l <= 
EWL_OBJECT_MAX_SIZE)
+                               && i_l > EWL_OBJECT_MIN_SIZE
+                               && i_l <= EWL_OBJECT_MAX_SIZE)
                        ewl_object_minimum_w_set(EWL_OBJECT(w), i_l);
 
                if (i_t > 0 && MINIMUM_H(w) == EWL_OBJECT_MIN_SIZE
-                               && i_t > EWL_OBJECT_MIN_SIZE && i_t <= 
EWL_OBJECT_MAX_SIZE)
+                               && i_t > EWL_OBJECT_MIN_SIZE
+                               && i_t <= EWL_OBJECT_MAX_SIZE)
                        ewl_object_minimum_h_set(EWL_OBJECT(w), i_t);
 
                /*
@@ -1122,11 +1145,13 @@
                i_t = (int)(height);
 
                if (i_l > 0 && MAXIMUM_W(w) == EWL_OBJECT_MAX_SIZE
-                               && i_l >= EWL_OBJECT_MIN_SIZE && i_l < 
EWL_OBJECT_MAX_SIZE)
+                               && i_l >= EWL_OBJECT_MIN_SIZE
+                               && i_l < EWL_OBJECT_MAX_SIZE)
                        ewl_object_maximum_w_set(EWL_OBJECT(w), i_l);
 
                if (i_t > 0 && MAXIMUM_H(w) == EWL_OBJECT_MAX_SIZE
-                               && i_t >= EWL_OBJECT_MIN_SIZE && i_t < 
EWL_OBJECT_MAX_SIZE)
+                               && i_t >= EWL_OBJECT_MIN_SIZE
+                               && i_t < EWL_OBJECT_MAX_SIZE)
                        ewl_object_maximum_h_set(EWL_OBJECT(w), i_t);
        }
 
@@ -1214,45 +1239,14 @@
  */
 void ewl_widget_reparent_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
-       int             layer;
        Ewl_Container  *pc;
-       Ewl_Embed      *emb;
-       Evas           *oevas = NULL;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
        pc = EWL_CONTAINER(w->parent);
-
-       /*
-        * If the new parent is on a different evas, we must re-realize it.
-        */
-       if (REALIZED(w)) {
-               if (w->fx_clip_box)
-                       oevas = evas_object_evas_get(w->fx_clip_box);
-               else if (w->theme_object)
-                       oevas = evas_object_evas_get(w->theme_object);
-
-               emb = ewl_embed_widget_find(w);
-               if (!emb || oevas != emb->evas)
-                       ewl_widget_unrealize(w);
-               else {
-
-                       /*
-                        * Set up the clip box again if necessary
-                        */
-                       if (pc && pc->clip_box && w->fx_clip_box)
-                               evas_object_clip_set(w->fx_clip_box,
-                                               pc->clip_box);
-
-                       layer = ewl_widget_layer_sum_get(EWL_WIDGET(pc)) +
-                               LAYER(w);
-                       if (w->fx_clip_box)
-                               evas_object_layer_set(w->fx_clip_box, layer);
-                       if (w->theme_object)
-                               evas_object_layer_set(w->theme_object, layer);
-               }
-       }
+       if (REALIZED(w))
+               ewl_widget_unrealize(w);
 
        if (pc && REALIZED(pc) && VISIBLE(w) && !REALIZED(w))
                ewl_realize_request(w);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_window.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -3 -r1.93 -r1.94
--- ewl_window.c        9 Dec 2004 05:26:11 -0000       1.93
+++ ewl_window.c        24 Dec 2004 22:16:41 -0000      1.94
@@ -508,7 +508,7 @@
        else
 #endif
        {
-               evas_free(evas);
+               ewl_evas_destroy(evas);
                DRETURN(DLEVEL_STABLE);
        }
 
@@ -548,9 +548,6 @@
        embed = EWL_EMBED(w);
        o = EWL_OBJECT(w);
 
-       ewl_evas_destroy(embed->evas);
-       embed->evas = NULL;
-
 #ifdef HAVE_EVAS_ENGINE_SOFTWARE_X11_H
        if (REALIZED(w) && strstr(EWL_WINDOW(w)->render, "x11")) {
                ecore_x_window_hide((Ecore_X_Window)embed->evas_window);
@@ -562,6 +559,9 @@
 #endif
        IF_FREE(EWL_WINDOW(w)->render);
 
+       ewl_evas_destroy(embed->evas);
+       embed->evas = NULL;
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to