Enlightenment CVS committal
Author : jethomas
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_box.c ewl_button.c ewl_container.c ewl_container.h
ewl_embed.c ewl_scrollpane.c ewl_seeker.c ewl_spinner.c
ewl_tree.c ewl_tree.h
Log Message:
- Fix bug 69
- Make focusing of widgets more intuitive
- Remove unneeded type from tree
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_box.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- ewl_box.c 22 Jan 2008 16:26:21 -0000 1.49
+++ ewl_box.c 24 Jan 2008 00:51:22 -0000 1.50
@@ -166,6 +166,9 @@
*/
ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
ewl_box_cb_configure, NULL);
+ ewl_callback_del(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_container_focus_out, NULL);
/*
* Check if the info structs have been created yet, if not create
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_button.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- ewl_button.c 6 Dec 2007 03:40:45 -0000 1.56
+++ ewl_button.c 24 Jan 2008 00:51:22 -0000 1.57
@@ -84,6 +84,10 @@
ewl_callback_append(w, EWL_CALLBACK_KEY_DOWN,
ewl_button_cb_key_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_container_cb_widget_focus_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_widget_focus_out, NULL);
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_container.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- ewl_container.c 8 Dec 2007 22:07:41 -0000 1.68
+++ ewl_container.c 24 Jan 2008 00:51:22 -0000 1.69
@@ -1601,3 +1601,91 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
+/**
+ * @internal
+ * @param w: The widget to work with
+ * @param ev_data: The event data
+ * @param user_data: UNUSED
+ * @return Returns no data
+ * @brief A callback to be used for container widgets such as scrollpane, box
+ */
+void
+ewl_container_cb_container_focus_out(Ewl_Widget *w, void *ev_data, void
*user_data)
+{
+ Ewl_Widget *focus_in = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+
+ if (ev_data)
+ focus_in = EWL_WIDGET(ev_data);
+
+ /* If its a child or is disabled then don't send a signal */
+ if ((focus_in) && (!ewl_widget_parent_of(w, focus_in)) &&
+ (!DISABLED(w)) && (focus_in != w))
+ ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: The widget to work with
+ * @param: ev_data: UNUSED
+ * @param user_data: UNUSED
+ * @return Returns no value
+ * @brief A callback to be used with end widgets such as buttons, etc
+ */
+void
+ewl_container_cb_widget_focus_out(Ewl_Widget *w, void *ev_data, void
*user_data)
+{
+ Ewl_Container *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
+
+ c = EWL_CONTAINER(w);
+ while (c->redirect)
+ c = c->redirect;
+
+ ecore_dlist_first_goto(c->children);
+ while ((w = ecore_dlist_next(c->children)))
+ ewl_widget_state_set(w, "focus,out", EWL_STATE_TRANSIENT);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: The widget to work with
+ * @param ev_data: UNUSED
+ * @param user_data: UNUSED
+ * @return Returns no value
+ * @brief A callback to be used with end widgets
+ */
+void
+ewl_container_cb_widget_focus_in(Ewl_Widget *w, void *ev_data, void *user_data)
+{
+ Ewl_Container *c;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR(w);
+
+ if (DISABLED(w))
+ DRETURN(DLEVEL_STABLE);
+
+ c = EWL_CONTAINER(w);
+ while (c->redirect)
+ c = c->redirect;
+
+ ecore_dlist_first_goto(c->children);
+ while ((w = ecore_dlist_next(c->children)))
+ ewl_widget_state_set(w, "focus,in", EWL_STATE_TRANSIENT);
+
+ DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_container.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- ewl_container.h 8 Dec 2007 22:07:41 -0000 1.35
+++ ewl_container.h 24 Jan 2008 00:51:22 -0000 1.36
@@ -185,6 +185,9 @@
void ewl_container_cb_unrealize(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_container_cb_enable(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_container_cb_disable(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_container_cb_container_focus_out(Ewl_Widget *w, void *ev_data, void
*user_data);
+void ewl_container_cb_widget_focus_out(Ewl_Widget *w, void *ev_data, void
*user_data);
+void ewl_container_cb_widget_focus_in(Ewl_Widget *w, void *ev_data, void
*user_data);
/**
* @}
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -3 -r1.141 -r1.142
--- ewl_embed.c 16 Jan 2008 21:55:00 -0000 1.141
+++ ewl_embed.c 24 Jan 2008 00:51:22 -0000 1.142
@@ -553,14 +553,6 @@
* causes the widget to be destroyed.
*/
deselect = embed->last.focused;
- temp = embed->last.clicked;
-
- /* There is container_callback_notify, but nothing for reverse situation
- * so if the last clicked is a child of the last focused then we use the
- * lower widget
- */
- if (deselect && temp && ewl_widget_parent_of(deselect, temp))
- deselect = embed->last.clicked;
/* we want the focused and last clicked to be the parent widget, not
* the internal children */
@@ -608,6 +600,9 @@
temp = temp->parent;
}
+ /* Set to upper widget */
+ widget = embed->last.focused;
+
/*
* Determine whether this widget has already been selected, if not,
* deselect the previously selected widget and notify it of the
@@ -622,13 +617,15 @@
!ewl_widget_parent_of(deselect, widget)) {
ewl_object_state_remove(EWL_OBJECT(deselect),
EWL_FLAG_STATE_FOCUSED);
- ewl_callback_call(deselect, EWL_CALLBACK_FOCUS_OUT);
+ ewl_callback_call_with_event_data(deselect,
+ EWL_CALLBACK_FOCUS_OUT, widget);
}
if (widget && !DISABLED(widget) && !DESTROYED(widget)) {
ewl_object_state_add(EWL_OBJECT(widget),
EWL_FLAG_STATE_FOCUSED);
- ewl_callback_call(widget, EWL_CALLBACK_FOCUS_IN);
+ ewl_callback_call_with_event_data(widget,
+ EWL_CALLBACK_FOCUS_IN, deselect);
}
}
@@ -1577,17 +1574,8 @@
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
if (embed->last.focused && (embed->last.focused != w))
- {
- /* We might set an internal widget focused during
- * mouse_down_feed, so we need to check if the last clicked is
- * a child. If so, it needs to get the unfocus callback
- * instead of parent
- */
- if (ewl_widget_parent_of(embed->last.focused,
embed->last.clicked))
- embed->last.focused = embed->last.clicked;
-
- ewl_callback_call(embed->last.focused, EWL_CALLBACK_FOCUS_OUT);
- }
+ ewl_callback_call_with_event_data(embed->last.focused,
+ EWL_CALLBACK_FOCUS_OUT, w);
embed->last.focused = w;
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_scrollpane.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- ewl_scrollpane.c 23 Jan 2008 01:51:31 -0000 1.32
+++ ewl_scrollpane.c 24 Jan 2008 00:51:22 -0000 1.33
@@ -68,6 +68,12 @@
ewl_container_callback_notify(EWL_CONTAINER(s), EWL_CALLBACK_FOCUS_IN);
ewl_container_callback_notify(EWL_CONTAINER(s), EWL_CALLBACK_FOCUS_OUT);
+ /* Remove the default focus out callback and replace with our own */
+ ewl_callback_del(w, EWL_CALLBACK_FOCUS_OUT, ewl_widget_cb_focus_out);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_container_focus_out, NULL);
+
+
s->hflag = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
s->vflag = EWL_SCROLLPANE_FLAG_AUTO_VISIBLE;
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_seeker.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ewl_seeker.c 12 Nov 2007 22:42:22 -0000 1.28
+++ ewl_seeker.c 24 Jan 2008 00:51:22 -0000 1.29
@@ -133,6 +133,10 @@
ewl_seeker_cb_mouse_move, NULL);
ewl_callback_append(w, EWL_CALLBACK_KEY_DOWN,
ewl_seeker_cb_key_down, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_container_cb_widget_focus_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_widget_focus_out, NULL);
/*
* Append a callback for catching mouse movements on the button and
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_spinner.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- ewl_spinner.c 12 Nov 2007 22:42:22 -0000 1.33
+++ ewl_spinner.c 24 Jan 2008 00:51:22 -0000 1.34
@@ -70,6 +70,10 @@
ewl_spinner_cb_value_changed, NULL);
ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
ewl_spinner_cb_destroy, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
+ ewl_container_cb_widget_focus_in, NULL);
+ ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
+ ewl_container_cb_widget_focus_out, NULL);
ewl_container_show_notify_set(EWL_CONTAINER(w),
ewl_spinner_cb_child_show);
ewl_container_resize_notify_set(EWL_CONTAINER(w),
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- ewl_tree.c 23 Jan 2008 01:51:31 -0000 1.57
+++ ewl_tree.c 24 Jan 2008 00:51:22 -0000 1.58
@@ -109,7 +109,6 @@
ewl_tree_headers_visible_set(tree, TRUE);
ewl_tree_fixed_rows_set(tree, FALSE);
ewl_tree_alternate_row_colors_set(tree, TRUE);
- tree->scroll_type = EWL_KINETIC_SCROLL_NONE;
ewl_callback_append(EWL_WIDGET(tree), EWL_CALLBACK_CONFIGURE,
ewl_tree_cb_configure, NULL);
@@ -1535,7 +1534,6 @@
if (!type)
DRETURN(DLEVEL_STABLE);
- tree->scroll_type = type;
scroll = ewl_tree_kinetic_scrollpane_get(tree);
if (scroll)
ewl_scrollpane_kinetic_scrolling_set(EWL_SCROLLPANE(scroll),
type);
@@ -1551,11 +1549,18 @@
Ewl_Kinetic_Scroll
ewl_tree_kinetic_scrolling_get(Ewl_Tree *tree)
{
+ Ewl_Scrollpane *scroll;
+ Ewl_Kinetic_Scroll type = EWL_KINETIC_SCROLL_NONE;
+
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(tree, EWL_KINETIC_SCROLL_NONE);
DCHECK_TYPE_RET(tree, EWL_TREE_TYPE, EWL_KINETIC_SCROLL_NONE);
- DRETURN_INT(tree->scroll_type, DLEVEL_STABLE);
+ scroll = ewl_tree_kinetic_scrollpane_get(tree);
+ if (scroll)
+ type = ewl_scrollpane_kinetic_scrolling_get(scroll);
+
+ DRETURN_INT(type, DLEVEL_STABLE);
}
/**
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- ewl_tree.h 23 Jan 2008 01:51:31 -0000 1.32
+++ ewl_tree.h 24 Jan 2008 00:51:22 -0000 1.33
@@ -119,8 +119,6 @@
unsigned char fixed:1; /**< Rows are fixed height */
unsigned char headers_visible:1; /**< Are the headers visible? */
unsigned char row_color_alternate:1; /**< Are the rows alternating? */
-
- Ewl_Kinetic_Scroll scroll_type; /**< Type of kinetic scrolling */
};
/*
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs