Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_container.c ewl_container.h ewl_embed.c ewl_menu_base.c ewl_scrollpane.c ewl_widget.c ewl_widget.h Log Message: - move ewl_container_parent_of to ewl_widget_parent_of =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_container.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- ewl_container.c 22 Dec 2005 23:42:40 -0000 1.21 +++ ewl_container.c 29 Dec 2005 17:21:15 -0000 1.22 @@ -177,7 +177,7 @@ if (pc == EWL_CONTAINER(child->parent)) DRETURN(DLEVEL_STABLE); - if (ewl_container_parent_of(child, EWL_WIDGET(pc))) { + if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) { DWARNING("Attempting to make a child a parent of itself"); DRETURN(DLEVEL_STABLE); } @@ -212,7 +212,7 @@ if (pc == EWL_CONTAINER(child->parent)) DRETURN(DLEVEL_STABLE); - if (ewl_container_parent_of(child, EWL_WIDGET(pc))) { + if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) { DWARNING("Attempting to make a child a parent of itself"); DRETURN(DLEVEL_STABLE); } @@ -252,7 +252,7 @@ if (pc == EWL_CONTAINER(child->parent)) DRETURN(DLEVEL_STABLE); - if (ewl_container_parent_of(child, EWL_WIDGET(pc))) { + if (ewl_widget_parent_of(child, EWL_WIDGET(pc))) { DWARNING("Attempting to make a child a parent of itself"); DRETURN(DLEVEL_STABLE); } @@ -583,34 +583,6 @@ } /** - * @param c: the container to compare against, safe to pass a non-container - * @param w: the widget to check parentage - * @return Returns TRUE if @a c is a parent of @a w, otherwise returns FALSE. - * @brief Determine if a container is a parent of a widget - */ -int -ewl_container_parent_of(Ewl_Widget *c, Ewl_Widget *w) -{ - Ewl_Widget *parent; - - DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR_RET("c", c, FALSE); - DCHECK_TYPE("c", c, "widget"); - - if (!w) { - DRETURN_INT(FALSE, DLEVEL_STABLE); - } - - parent = w; - while ((parent = parent->parent)) { - if (parent == c) - DRETURN_INT(TRUE, DLEVEL_STABLE); - } - - DRETURN_INT(FALSE, DLEVEL_STABLE); -} - -/** * @param c: the container to reset * @return Returns no value. * @brief Destroy all children of the container =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_container.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ewl_container.h 22 Dec 2005 23:42:40 -0000 1.9 +++ ewl_container.h 29 Dec 2005 17:21:15 -0000 1.10 @@ -134,7 +134,6 @@ int y); Ewl_Widget *ewl_container_child_at_recursive_get(Ewl_Container *widget, int x, int y); -int ewl_container_parent_of(Ewl_Widget *c, Ewl_Widget *w); void ewl_container_largest_prefer(Ewl_Container *c, Ewl_Orientation o); void ewl_container_sum_prefer(Ewl_Container *c, Ewl_Orientation o); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_embed.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- ewl_embed.c 28 Dec 2005 15:58:32 -0000 1.33 +++ ewl_embed.c 29 Dec 2005 17:21:15 -0000 1.34 @@ -630,7 +630,7 @@ * old and newly focused widgets. */ while (embed->last.mouse_in && (widget != embed->last.mouse_in) - && !ewl_container_parent_of(embed->last.mouse_in, widget)) { + && !ewl_widget_parent_of(embed->last.mouse_in, widget)) { ewl_object_state_remove(EWL_OBJECT(embed->last.mouse_in), EWL_FLAG_STATE_MOUSE_IN); ewl_callback_call(embed->last.mouse_in, EWL_CALLBACK_MOUSE_OUT); @@ -1092,7 +1092,7 @@ DCHECK_TYPE("e", e, "embed"); DCHECK_TYPE("w", w, "widget"); - if (!ewl_container_parent_of(EWL_WIDGET(e), w)) + if (!ewl_widget_parent_of(EWL_WIDGET(e), w)) DRETURN(DLEVEL_STABLE); /* do nothing if this widget isn't focusable */ @@ -1379,18 +1379,18 @@ DCHECK_PARAM_PTR("e", e); DCHECK_TYPE("e", e, "embed"); - if ((w == e->last.focused) || (RECURSIVE(w) && ewl_container_parent_of(w, e->last.focused))) { + if ((w == e->last.focused) || (RECURSIVE(w) && ewl_widget_parent_of(w, e->last.focused))) { e->last.focused = NULL; /*ewl_embed_focused_widget_set(e, NULL);*/ } - if ((w == e->last.clicked) || (RECURSIVE(w) && ewl_container_parent_of(w, e->last.clicked))) + if ((w == e->last.clicked) || (RECURSIVE(w) && ewl_widget_parent_of(w, e->last.clicked))) e->last.clicked = NULL; - if ((w == e->last.mouse_in) || (RECURSIVE(w) && ewl_container_parent_of(w, e->last.mouse_in))) + if ((w == e->last.mouse_in) || (RECURSIVE(w) && ewl_widget_parent_of(w, e->last.mouse_in))) e->last.mouse_in = NULL; - if ((w == e->dnd_widget) || (RECURSIVE(w) && ewl_container_parent_of(w, e->dnd_widget))) + if ((w == e->dnd_widget) || (RECURSIVE(w) && ewl_widget_parent_of(w, e->dnd_widget))) e->dnd_widget = NULL; DLEAVE_FUNCTION(DLEVEL_STABLE); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_menu_base.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- ewl_menu_base.c 8 Dec 2005 08:45:39 -0000 1.15 +++ ewl_menu_base.c 29 Dec 2005 17:21:15 -0000 1.16 @@ -126,7 +126,7 @@ menu = EWL_MENU_BASE(w); focused = ewl_widget_focused_get(); - if (!focused || !ewl_container_parent_of(menu->popbox, focused)) + if (!focused || !ewl_widget_parent_of(menu->popbox, focused)) ewl_widget_hide(menu->popup); DLEAVE_FUNCTION(DLEVEL_STABLE); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_scrollpane.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ewl_scrollpane.c 29 Dec 2005 17:12:09 -0000 1.12 +++ ewl_scrollpane.c 29 Dec 2005 17:21:15 -0000 1.13 @@ -479,7 +479,7 @@ * Get the focused widget and stop if its an internal one. */ focus = ewl_embed_focused_widget_get(emb); - if (!focus || !ewl_container_parent_of(s->box, focus) || + if (!focus || !ewl_widget_parent_of(s->box, focus) || ewl_widget_onscreen_is(focus)) DRETURN(DLEVEL_STABLE); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -3 -r1.55 -r1.56 --- ewl_widget.c 29 Dec 2005 17:12:09 -0000 1.55 +++ ewl_widget.c 29 Dec 2005 17:21:15 -0000 1.56 @@ -1528,6 +1528,34 @@ } /** + * @param c: the widget to compare against + * @param w: the widget to check parentage + * @return Returns TRUE if @a c is a parent of @a w, otherwise returns FALSE. + * @brief Determine if a widget is a parent of another widget + */ +int +ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w) +{ + Ewl_Widget *parent; + + DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR_RET("c", c, FALSE); + DCHECK_TYPE("c", c, "widget"); + + if (!w) { + DRETURN_INT(FALSE, DLEVEL_STABLE); + } + + parent = w; + while ((parent = parent->parent)) { + if (parent == c) + DRETURN_INT(TRUE, DLEVEL_STABLE); + } + + DRETURN_INT(FALSE, DLEVEL_STABLE); +} + +/** * @param w: the widget to receive keyboard focus * @return Returns no value. * @brief Changes the keyboard focus to the widget @a w. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_widget.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- ewl_widget.h 29 Dec 2005 17:12:09 -0000 1.31 +++ ewl_widget.h 29 Dec 2005 17:21:15 -0000 1.32 @@ -173,6 +173,7 @@ void ewl_widget_color_set(Ewl_Widget *w, int r, int g, int b, int a); void ewl_widget_color_get(Ewl_Widget *w, int *r, int *g, int *b, int *a); +int ewl_widget_parent_of(Ewl_Widget *c, Ewl_Widget *w); void ewl_widget_draggable_set(Ewl_Widget* w, unsigned int val, Ewl_Widget_Drag cb); Ewl_Widget *ewl_widget_drag_candidate_get(void); ------------------------------------------------------- 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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs