Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_box.c ewl_cell.c ewl_container.c ewl_freebox.c ewl_grid.c 
        ewl_highlight.c ewl_overlay.c ewl_paned.c ewl_tree.c 
        ewl_widget.c ewl_widget.h 


Log Message:
add unmanaged flag, this indicates that a container should ignore a child 
because it manages its placement etc. itself

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_box.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- ewl_box.c   15 Feb 2008 23:30:03 -0000      1.51
+++ ewl_box.c   15 Feb 2008 23:52:22 -0000      1.52
@@ -239,8 +239,10 @@
 
        c = EWL_CONTAINER(b);
        ecore_dlist_first_goto(c->children);
-       while ((child = ecore_dlist_next(c->children)))
-               ewl_box_cb_child_show(c, child);
+       while ((child = ecore_dlist_next(c->children))) {
+               if (!UNMANAGED(child))
+                       ewl_box_cb_child_show(c, child);
+       }
 
        ewl_widget_configure(EWL_WIDGET(b));
 
@@ -599,7 +601,7 @@
                int change;
                unsigned int policy;
 
-               if (!VISIBLE(child))
+               if (!VISIBLE(child) || UNMANAGED(child))
                        continue;
                /*
                 * Place the child on a list depending on it's matching
@@ -776,19 +778,19 @@
        ecore_dlist_first_goto(EWL_CONTAINER(b)->children);
        while ((child = ecore_dlist_next(EWL_CONTAINER(b)->children))) {
 
-               if (VISIBLE(child)) {
+               if (!VISIBLE(child) || UNMANAGED(child))
+                       continue;
 
-                       /*
-                        * Position this child based on the determined values.
-                        */
-                       ewl_box_configure_child(b, child, x, y, align,
-                                                 align_size);
+               /*
+                * Position this child based on the determined values.
+                */
+               ewl_box_configure_child(b, child, x, y, align,
+                               align_size);
 
-                       /*
-                        * Move to the next position for the child.
-                        */
-                       *fill += ewl_box_info->fill_ask(child) + b->spacing;
-               }
+               /*
+                * Move to the next position for the child.
+                */
+               *fill += ewl_box_info->fill_ask(child) + b->spacing;
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_cell.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_cell.c  12 Nov 2007 22:42:22 -0000      1.19
+++ ewl_cell.c  15 Feb 2008 23:52:22 -0000      1.20
@@ -82,7 +82,11 @@
 
        c = EWL_CONTAINER(w);
 
-       child = ecore_dlist_first_goto(c->children);
+       /* we need to skip all unmanaged widgets first */
+       ecore_dlist_first_goto(c->children);
+       while ((child = ecore_dlist_next(c->children)) && UNMANAGED(child))
+               ;
+
        if (child)
                ewl_object_place(child, CURRENT_X(w), CURRENT_Y(w),
                                CURRENT_W(w), CURRENT_H(w));
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_container.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -3 -r1.69 -r1.70
--- ewl_container.c     24 Jan 2008 00:51:22 -0000      1.69
+++ ewl_container.c     15 Feb 2008 23:52:22 -0000      1.70
@@ -1097,6 +1097,10 @@
        DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
        DCHECK_TYPE(w, EWL_WIDGET_TYPE);
 
+       /* ignore unmanaged children */
+       if (UNMANAGED(w))
+               DRETURN(DLEVEL_STABLE);
+
        if (c->child_add)
                c->child_add(c, w);
 
@@ -1122,6 +1126,10 @@
        /* do nothing if the container is being destroyed */
        if (DESTROYED(c))
                DRETURN(DLEVEL_STABLE);
+       
+       /* ignore unmanaged children */
+       if (UNMANAGED(w))
+               DRETURN(DLEVEL_STABLE);
 
        if (c->child_remove)
                c->child_remove(c, w, idx);
@@ -1144,6 +1152,10 @@
        DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
        DCHECK_TYPE(w, EWL_WIDGET_TYPE);
 
+       /* ignore unmanaged children */
+       if (UNMANAGED(w))
+               DRETURN(DLEVEL_STABLE);
+
        c->visible_children++;
        if (c->child_show)
                c->child_show(c, w);
@@ -1173,6 +1185,10 @@
        DCHECK_PARAM_PTR(w);
        DCHECK_TYPE(c, EWL_CONTAINER_TYPE);
        DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+       /* ignore unmanaged children */
+       if (UNMANAGED(w))
+               DRETURN(DLEVEL_STABLE);
 
        /* do nothing if the container is being destroyed */
        if (DESTROYED(c))
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_freebox.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_freebox.c       11 Dec 2007 21:38:33 -0000      1.26
+++ ewl_freebox.c       15 Feb 2008 23:52:22 -0000      1.27
@@ -393,7 +393,7 @@
        ecore_dlist_first_goto(c->children);
        while ((child = ecore_dlist_next(c->children)))
        {
-               if (!VISIBLE(child)) continue;
+               if (!VISIBLE(child) || UNMANAGED(child)) continue;
                ewl_object_preferred_size_get(EWL_OBJECT(child),
                                                &child_w, &child_h);
 
@@ -418,7 +418,7 @@
        ecore_dlist_first_goto(c->children);
        while ((child = ecore_dlist_next(c->children)))
        {
-               if (!VISIBLE(child)) continue;
+               if (!VISIBLE(child) || UNMANAGED(child)) continue;
                ewl_object_preferred_size_get(EWL_OBJECT(child),
                                                &child_w, &child_h);
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_grid.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- ewl_grid.c  12 Nov 2007 22:42:22 -0000      1.43
+++ ewl_grid.c  15 Feb 2008 23:52:22 -0000      1.44
@@ -476,6 +476,9 @@
                ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
                while ((c = ecore_dlist_next(EWL_CONTAINER(g)->children))
                                && c != w) {
+                       if (UNMANAGED(child))
+                               continue;
+
                        if (!ewl_widget_data_get(c, g))
                                go_next(g, &col, &row);
                }
@@ -923,6 +926,9 @@
 
        ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
        while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
+               if (UNMANAGED(child))
+                       continue;
+
                c = (Ewl_Grid_Child *)ewl_widget_data_get(child, (void *) g);
                if (c) {
                        /*
@@ -1015,6 +1021,9 @@
 
        ecore_dlist_first_goto(EWL_CONTAINER(g)->children);
        while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
+               if (UNMANAGED(child))
+                       continue;
+
                c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *)g);
                if (!c) continue;
 
@@ -1068,6 +1077,9 @@
        while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
                int pref_w, pref_h;
 
+               if (UNMANAGED(child))
+                       continue;
+
                c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *) g);
                if (c) continue;
 
@@ -1091,6 +1103,9 @@
        while ((child = ecore_dlist_next(EWL_CONTAINER(g)->children))) {
                int pref_w = 0, pref_h = 0;
                int i;
+
+               if (UNMANAGED(child))
+                       continue;
 
                c = (Ewl_Grid_Child *) ewl_widget_data_get(child, (void *) g);
                if (!c) continue;
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_highlight.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_highlight.c     12 Nov 2007 22:42:22 -0000      1.9
+++ ewl_highlight.c     15 Feb 2008 23:52:22 -0000      1.10
@@ -7,6 +7,10 @@
 
 static void ewl_highlight_cb_follow_configure(Ewl_Widget *w,
                                        void *ev, void *data);
+static void ewl_highlight_cb_follow_reveal(Ewl_Widget *w,
+                                       void *ev, void *data);
+static void ewl_highlight_cb_follow_obscure(Ewl_Widget *w,
+                                       void *ev, void *data);
 static void ewl_highlight_cb_follow_destroy(Ewl_Widget *w,
                                        void *ev, void *data);
 static void ewl_highlight_cb_destroy(Ewl_Widget *w, void *ev, void *data);
@@ -52,6 +56,7 @@
        ewl_widget_appearance_set(EWL_WIDGET(h), EWL_HIGHLIGHT_TYPE);
        ewl_widget_inherit(EWL_WIDGET(h), EWL_HIGHLIGHT_TYPE);
        ewl_widget_internal_set(EWL_WIDGET(h), TRUE);
+       ewl_widget_unmanaged_set(EWL_WIDGET(h), TRUE);
        ewl_widget_layer_top_set(EWL_WIDGET(h), TRUE);
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
@@ -77,12 +82,18 @@
                                ewl_highlight_cb_follow_destroy, h);
        ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
                                ewl_highlight_cb_follow_configure, h);
+       ewl_callback_append(w, EWL_CALLBACK_REVEAL,
+                               ewl_highlight_cb_follow_reveal, h);
+       ewl_callback_append(w, EWL_CALLBACK_OBSCURE,
+                               ewl_highlight_cb_follow_obscure, h);
 
        /* prepend this so we can use the floater follow set call to cleanup
         * floater stuff */
        ewl_callback_prepend(EWL_WIDGET(h), EWL_CALLBACK_DESTROY,
                                ewl_highlight_cb_destroy, w);
 
+       ewl_widget_configure(w);
+
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -119,6 +130,32 @@
 }
 
 static void
+ewl_highlight_cb_follow_reveal(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
+                                                       void *data)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(data);
+       DCHECK_TYPE(data, EWL_HIGHLIGHT_TYPE);
+
+       ewl_widget_show(EWL_WIDGET(data));
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
+ewl_highlight_cb_follow_obscure(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
+                                                       void *data)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(data);
+       DCHECK_TYPE(data, EWL_HIGHLIGHT_TYPE);
+
+       ewl_widget_hide(EWL_WIDGET(data));
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+static void
 ewl_highlight_cb_follow_destroy(Ewl_Widget *w __UNUSED__,
                                void *ev __UNUSED__, void *data)
 {
@@ -146,6 +183,11 @@
        ewl_floater_follow_set(EWL_FLOATER(w), NULL);
        ewl_callback_del(EWL_WIDGET(data), EWL_CALLBACK_CONFIGURE,
                                        ewl_highlight_cb_follow_configure);
+       ewl_callback_del(EWL_WIDGET(data), EWL_CALLBACK_REVEAL,
+                                       ewl_highlight_cb_follow_reveal);
+       ewl_callback_del(EWL_WIDGET(data), EWL_CALLBACK_OBSCURE,
+                                       ewl_highlight_cb_follow_obscure);
+
        ewl_callback_del(EWL_WIDGET(data), EWL_CALLBACK_DESTROY,
                                        ewl_highlight_cb_follow_destroy);
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_overlay.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- ewl_overlay.c       5 Dec 2007 16:44:53 -0000       1.24
+++ ewl_overlay.c       15 Feb 2008 23:52:22 -0000      1.25
@@ -94,6 +94,9 @@
        ecore_dlist_first_goto(EWL_CONTAINER(w)->children);
        while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) {
                int width, height;
+               /* ignore unmanaged widgets */
+               if (UNMANAGED(child))
+                       continue;
                /*
                 * Try to give the child the full size of the overlay from it's
                 * base position. The object will constrict it based on the
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_paned.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -3 -r1.65 -r1.66
--- ewl_paned.c 5 Jan 2008 20:35:21 -0000       1.65
+++ ewl_paned.c 15 Feb 2008 23:52:22 -0000      1.66
@@ -592,7 +592,7 @@
                        if (left) g = child;
                        ewl_widget_hide(child);
                }
-               else if (VISIBLE(child))
+               else if (VISIBLE(child) && !UNMANAGED(child))
                {
                        left = 1;
 
@@ -630,7 +630,8 @@
        ecore_dlist_first_goto(c->children);
        while ((child = ecore_dlist_next(c->children)))
        {
-               if (!VISIBLE(child) || EWL_PANED_GRABBER_IS(child)) 
+               if (!VISIBLE(child) || EWL_PANED_GRABBER_IS(child) 
+                               || UNMANAGED(child)) 
                        continue;
 
                panes->info = ewl_paned_size_info_get(p, child);
@@ -682,7 +683,7 @@
        {
                int pos;
 
-               if (!VISIBLE(child))
+               if (!VISIBLE(child) || UNMANAGED(child))
                        continue;
                if (!EWL_PANED_GRABBER_IS(child))
                {
@@ -828,7 +829,7 @@
        ecore_dlist_first_goto(c->children);
        while ((child = ecore_dlist_next(c->children)))
        {
-               if (!VISIBLE(child))
+               if (!VISIBLE(child) || UNMANAGED(child))
                        continue;
 
                if (EWL_PANED_GRABBER_IS(child))
@@ -1203,7 +1204,7 @@
        ecore_dlist_previous(c->children);
        while ((child = ecore_dlist_previous(c->children)))
        {
-               if (!VISIBLE(child)) continue;
+               if (!VISIBLE(child) || UNMANAGED(child)) continue;
 
                if (EWL_PANED_GRABBER_IS(child))
                {
@@ -1230,7 +1231,7 @@
        ecore_dlist_next(c->children);
        while ((child = ecore_list_next(c->children)))
        {
-               if (!VISIBLE(child)) continue;
+               if (!VISIBLE(child) || UNMANAGED(child)) continue;
 
                if (EWL_PANED_GRABBER_IS(child)) {
                        stop_grabber = EWL_PANED_GRABBER(child);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- ewl_tree.c  24 Jan 2008 00:51:22 -0000      1.58
+++ ewl_tree.c  15 Feb 2008 23:52:22 -0000      1.59
@@ -1177,7 +1177,8 @@
        ecore_dlist_first_goto(EWL_CONTAINER(node)->children);
        while ((child = ecore_dlist_next(EWL_CONTAINER(node)->children)))
        {
-               if ((child != node->handle) && (child != EWL_WIDGET(node->row)))
+               if ((child != node->handle) && (child != EWL_WIDGET(node->row))
+                               && !UNMANAGED(child))
                        ecore_list_append(tmp, child);
        }
 
@@ -1259,7 +1260,8 @@
        ecore_dlist_first_goto(EWL_CONTAINER(node)->children);
        while ((child = ecore_dlist_next(EWL_CONTAINER(node)->children)))
        {
-               if ((child != node->handle) && (child != EWL_WIDGET(node->row)))
+               if ((child != node->handle) && (child != EWL_WIDGET(node->row))
+                               && !UNMANAGED(child))
                        ecore_list_append(tmp, child);
        }
 
@@ -1317,7 +1319,6 @@
        c = EWL_CONTAINER(w);
        if (!c->children) DRETURN(DLEVEL_STABLE);
 
-       ecore_dlist_first_goto(c->children);
        x = CURRENT_X(w);
        y = CURRENT_Y(w);
 
@@ -1333,9 +1334,11 @@
        /*
         * All subsequent children are lower nodes and rows.
         */
+       ecore_dlist_first_goto(c->children);
        while ((child = ecore_dlist_next(c->children)))
        {
-               if (VISIBLE(child) && EWL_WIDGET(child) != node->handle)
+               if (VISIBLE(child) && EWL_WIDGET(child) != node->handle
+                               && !UNMANAGED(child))
                {
                        ewl_object_geometry_request(child, x, y, CURRENT_W(w) - 
hw,
                                                    
ewl_object_preferred_h_get(child));
@@ -1452,7 +1455,7 @@
        if (w == node->handle)
                DRETURN(DLEVEL_STABLE);
 
-       if (ecore_dlist_count(c->children) < 3)
+       if (ewl_container_child_count_visible_get(c) < 3)
        {
                if (node->handle && VISIBLE(node->handle))
                        ewl_widget_hide(node->handle);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -3 -r1.156 -r1.157
--- ewl_widget.c        13 Jan 2008 00:48:20 -0000      1.156
+++ ewl_widget.c        15 Feb 2008 23:52:22 -0000      1.157
@@ -1607,6 +1607,39 @@
 }
 
 /**
+ * @internal
+ * @param w: the widget to mark as unmanaged
+ * @param val: a boolean to indicate the state of the unmanaged flag
+ * @return Returns no value.
+ * @brief Marks a widget to be ignored by the parent container.
+ *
+ * A widget marked as unmanaged will not be placed by the container. This
+ * is important for widget that manage to place them self like a floater.
+ * Nevertheless the widget will recieve events through the parent and shares
+ * the same layer with its sibling widgets. In most cases you also want to
+ * set it as internal.
+ *
+ * Note: You cannot change the unmanaged state if the widget already has
+ * a parent.
+ */
+void
+ewl_widget_unmanaged_set(Ewl_Widget *w, unsigned int val)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR(w);
+       DCHECK_TYPE(w, EWL_WIDGET_TYPE);
+
+       if (w->parent) {
+               DWARNING("It is not possible to change the unmanage state "
+                               "of a widget that has already a parent!\n");
+               DRETURN(DLEVEL_STABLE);
+       }
+       UNMANAGED(w) = !!val;
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
  * @param widget: the widget to set the inheritance on
  * @param inherit: the string to append to the inheritance
  * @return Returns no value.
@@ -1737,6 +1770,22 @@
                DRETURN_INT(TRUE, DLEVEL_STABLE);
 
        DRETURN_INT(FALSE, DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: the widget to query the state of the unmanaged flag
+ * @return Returns TRUE if the widget is marked unmanaged, otherwise FALSE.
+ * @brief Checks the widget for the internal flag.
+ */
+unsigned int
+ewl_widget_unmanaged_is(Ewl_Widget *w)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET(w, FALSE);
+       DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, FALSE);
+
+       DRETURN_INT(UNMANAGED(w), DLEVEL_STABLE);
 }
 
 /**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- ewl_widget.h        11 Nov 2007 06:07:46 -0000      1.68
+++ ewl_widget.h        15 Feb 2008 23:52:22 -0000      1.69
@@ -153,11 +153,14 @@
        const char *appearance;   /**< Key to lookup appearance in theme */
        const char *inheritance;  /**< Inheritance of path widget */
        int layer;              /**< the layer relative to the parent */
-       int toplayered;         /**< Indicates if the widget should
-                                               be on the top of the layer 
stack */
 
        Ecore_Hash *theme;              /**< Overriding theme settings */
        Ewl_Pair_List theme_text;       /**< Overriding text in theme */
+       
+       unsigned char toplayered:1;     /**< Indicates if the widget should
+                                       be on the top of the layer stack */
+       unsigned char unmanaged:1;
+
 };
 
 Ewl_Widget     *ewl_widget_new(void);
@@ -220,6 +223,9 @@
 void            ewl_widget_internal_set(Ewl_Widget *w, unsigned int val);
 unsigned int     ewl_widget_internal_is(Ewl_Widget *w);
 
+void            ewl_widget_unmanaged_set(Ewl_Widget *w, unsigned int val);
+unsigned int     ewl_widget_unmanaged_is(Ewl_Widget *w);
+
 void            ewl_widget_clipped_set(Ewl_Widget *w, unsigned int val);
 unsigned int     ewl_widget_clipped_is(Ewl_Widget *w);
 
@@ -245,6 +251,9 @@
                                                        unsigned int *b, 
unsigned int *a);
 
 int             ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w);
+
+
+#define UNMANAGED(w) (EWL_WIDGET(w)->unmanaged)
 
 /*
  * Internally used callbacks, override at your own risk.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to