From: <enl...@li...> - 2005-10-10 23:42:19
|
Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl Dir : e17/libs/ewl/src/lib Modified Files: ewl_attach.c ewl_button.c ewl_debug.h ewl_entry.c Log Message: - oops, make this compile with DEBUG = 1 =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_attach.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ewl_attach.c 9 Oct 2005 05:18:39 -0000 1.6 +++ ewl_attach.c 10 Oct 2005 23:42:20 -0000 1.7 @@ -12,6 +12,7 @@ Ewl_Widget *box; Ewl_Attach *attach; + Ewl_Widget *parent; Evas_Coord x; Evas_Coord y; @@ -20,11 +21,13 @@ }; static void ewl_attach_parent_setup(Ewl_Widget *w); -static void ewl_attach_cb_parent_destroy(Ewl_Widget *w, void *ev, void *data); + static void ewl_attach_attach_type_setup(Ewl_Widget *w, Ewl_Attach *attach); -static void ewl_attach_tooltip_attach(Ewl_Widget *w, Ewl_Attach *attach); -static void ewl_attach_tooltip_detach(Ewl_Attach *attach); +static void ewl_attach_tooltip_setup(Ewl_Widget *w, Ewl_Attach *attach); +static void ewl_attach_tooltip_attach(Ewl_Widget *w, Ewl_Attach *attach, + int cur_x, int cur_y); +static void ewl_attach_tooltip_detach(void); static void ewl_attach_cb_tooltip_win_destroy(Ewl_Widget *w, void *ev, void *data); @@ -234,7 +237,7 @@ switch (attach->type) { case EWL_ATTACH_TYPE_TOOLTIP: - ewl_attach_tooltip_attach(w, attach); + ewl_attach_tooltip_setup(w, attach); break; case EWL_ATTACH_TYPE_COLOR: @@ -261,7 +264,7 @@ Ewl_Attach *tmp; tmp = EWL_ATTACH(list->list); - if (tmp->type == type) + if (tmp && (tmp->type == type)) { ewl_attach_free(tmp); list->len --; @@ -278,8 +281,7 @@ for (i = 0; i < list->len; i++) { tmp = EWL_ATTACH(list->list[i]); - - if (tmp->type == type) + if (tmp && (tmp->type == type)) { ewl_attach_free(tmp); list->len --; @@ -379,6 +381,14 @@ DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("attach", attach); + if (ewl_attach_tooltip + && (ewl_attach_tooltip->attach == attach)) + { + ecore_timer_del(ewl_attach_tooltip->attach); + ewl_attach_tooltip->attach = NULL; + } + + /* XXX should we clean up _WIDGET in here? */ if ((attach->type == EWL_ATTACH_DATA_TYPE_TEXT) @@ -397,85 +407,100 @@ DCHECK_PARAM_PTR("w", w); w->attach = ewl_attach_list_new(); - ewl_callback_append(w, EWL_CALLBACK_DESTROY, ewl_attach_cb_parent_destroy, NULL); DLEAVE_FUNCTION(DLEVEL_STABLE); } static void -ewl_attach_cb_parent_destroy(Ewl_Widget *w, void *ev, void *data) +ewl_attach_tooltip_setup(Ewl_Widget *w, Ewl_Attach *attach) { DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("w", w); - - if (w->attach) - ewl_attach_list_free(w->attach); + DCHECK_PARAM_PTR("attach", attach); - w->attach = NULL; + ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE, + ewl_attach_cb_tooltip_mouse_move, attach); + ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN, + ewl_attach_cb_tooltip_mouse_down, attach); + ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT, + ewl_attach_cb_tooltip_focus_out, attach); DLEAVE_FUNCTION(DLEVEL_STABLE); } static void -ewl_attach_tooltip_attach(Ewl_Widget *w, Ewl_Attach *attach) +ewl_attach_tooltip_attach(Ewl_Widget *w, Ewl_Attach *attach, int cur_x, int cur_y) { DENTER_FUNCTION(DLEVEL_STABLE); + DCHECK_PARAM_PTR("w", w); DCHECK_PARAM_PTR("attach", attach); + /* if we are the same widget then short circute */ + if (ewl_attach_tooltip && (ewl_attach_tooltip->parent == w)) + { + ewl_attach_tooltip->x = cur_x + 15; + ewl_attach_tooltip->y = cur_y + 15; + + if (ewl_attach_tooltip->timer) + ecore_timer_del(ewl_attach_tooltip->timer); + + ewl_attach_tooltip->timer = ecore_timer_add(1.0, ewl_attach_cb_tooltip_timer, w); + DRETURN(DLEVEL_STABLE); + } + + ewl_attach_tooltip_detach(); + if (!ewl_attach_tooltip) + { ewl_attach_tooltip = NEW(Ewl_Attach_Tooltip, 1); + } ewl_attach_tooltip->attach = attach; + ewl_attach_tooltip->parent = w; - ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE, - ewl_attach_cb_tooltip_mouse_move, attach); - ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN, - ewl_attach_cb_tooltip_mouse_down, attach); - ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT, - ewl_attach_cb_tooltip_focus_out, attach); + /* XXX the 15 should come from the theme (offset off of the cursor) */ + /* XXX the 1.0 shoudl come from the theme (delay before firing timer) */ + ewl_attach_tooltip->x = cur_x + 15; + ewl_attach_tooltip->y = cur_y + 15; + + ewl_attach_tooltip->timer = ecore_timer_add(1.0, ewl_attach_cb_tooltip_timer, w); DLEAVE_FUNCTION(DLEVEL_STABLE); } static void -ewl_attach_tooltip_detach(Ewl_Attach *attach) +ewl_attach_tooltip_detach(void) { DENTER_FUNCTION(DLEVEL_STABLE); - DCHECK_PARAM_PTR("attach", attach); - /* make sure the display attach is our attach */ - if (ewl_attach_tooltip->attach != attach) + if (!ewl_attach_tooltip) { DRETURN(DLEVEL_STABLE); } - if (ewl_attach_tooltip) - { - if (ewl_attach_tooltip->timer) - ecore_timer_del(ewl_attach_tooltip->timer); + if (ewl_attach_tooltip->timer) + ecore_timer_del(ewl_attach_tooltip->timer); - ewl_attach_tooltip->timer = NULL; - ewl_attach_tooltip->x = 0; - ewl_attach_tooltip->y = 0; - - /* hide window if needed */ - if (ewl_attach_tooltip->win && (VISIBLE(ewl_attach_tooltip->win))) - ewl_widget_hide(ewl_attach_tooltip->win); + ewl_attach_tooltip->timer = NULL; + ewl_attach_tooltip->x = 0; + ewl_attach_tooltip->y = 0; + + /* hide window if needed */ + if (ewl_attach_tooltip->win && (VISIBLE(ewl_attach_tooltip->win))) + ewl_widget_hide(ewl_attach_tooltip->win); - /* cleanup the display window */ - if (ewl_attach_tooltip->box) + /* cleanup the display window */ + if (ewl_attach_tooltip->box) + { + if (ewl_attach_tooltip->attach->data_type == EWL_ATTACH_DATA_TYPE_TEXT) { - if (attach->data_type == EWL_ATTACH_DATA_TYPE_TEXT) - { - ewl_widget_destroy(ewl_attach_tooltip->box); - ewl_attach_tooltip->box = NULL; - } - else - ewl_container_child_remove(EWL_CONTAINER(ewl_attach_tooltip->box), - EWL_WIDGET(attach->data)); + ewl_widget_destroy(ewl_attach_tooltip->box); + ewl_attach_tooltip->box = NULL; } - ewl_attach_tooltip->attach = NULL; + else + ewl_container_child_remove(EWL_CONTAINER(ewl_attach_tooltip->box), + EWL_WIDGET(ewl_attach_tooltip->attach->data)); } + ewl_attach_tooltip->attach = NULL; DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -484,9 +509,7 @@ ewl_attach_cb_tooltip_mouse_move(Ewl_Widget *w, void *ev, void *data) { Ewl_Attach *attach; - Ewl_Embed *emb; Ewl_Event_Mouse_Move *e; - int x, y; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("ev", ev); @@ -494,25 +517,7 @@ e = ev; attach = data; - - if (!ewl_attach_tooltip) - ewl_attach_tooltip = NEW(Ewl_Attach_Tooltip, 1); - - ewl_attach_tooltip_detach(attach); - - emb = ewl_embed_widget_find(w); - ewl_window_position_get(EWL_WINDOW(emb), &x, &y); - - /* XXX the 15 should come from the theme (offset off of the cursor) */ - /* XXX the 1.0 shoudl come from the theme (delay before firing timer) */ - ewl_attach_tooltip->attach = attach; - ewl_attach_tooltip->x = e->x + 15; - ewl_attach_tooltip->y = e->y + 15; -#if 0 - ewl_attach_tooltip->x = x + CURRENT_X(w) + e->x + 15; - ewl_attach_tooltip->y = y + CURRENT_Y(w) + e->y + 15; -#endif - ewl_attach_tooltip->timer = ecore_timer_add(1.0, ewl_attach_cb_tooltip_timer, w); + ewl_attach_tooltip_attach(w, attach, e->x, e->y); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -520,13 +525,10 @@ static void ewl_attach_cb_tooltip_mouse_down(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data) { - Ewl_Attach *attach; - DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("data", data); - attach = data; - ewl_attach_tooltip_detach(attach); + ewl_attach_tooltip_detach(); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -535,13 +537,10 @@ ewl_attach_cb_tooltip_focus_out(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, void *data) { - Ewl_Attach *attach; - DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("data", data); - attach = data; - ewl_attach_tooltip_detach(attach); + ewl_attach_tooltip_detach(); DLEAVE_FUNCTION(DLEVEL_STABLE); } @@ -549,37 +548,23 @@ static int ewl_attach_cb_tooltip_timer(void *data) { - Ewl_Widget *w; Ewl_Embed *emb; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET("data", data, FALSE); - w = data; - emb = ewl_embed_widget_find(w); +DRETURN_INT(FALSE, DLEVEL_STABLE); - /* XXX i think there is a race condition with the detach code? - * ie, we get the focus_out (or something) stuck in the event queue - * and then we get the timer trigger in the event queue. the focus - * out is processed, then the trigger is processed ... blam ->attach - * is null */ - if (!(ewl_attach_tooltip->attach)) + if (!ewl_attach_tooltip->attach) { DRETURN_INT(FALSE, DLEVEL_STABLE); } + emb = ewl_embed_widget_find(EWL_WIDGET(data)); + if (!(ewl_attach_tooltip->win)) { ewl_attach_tooltip->embed = EWL_WIDGET(emb); -#if 0 - ewl_attach_tooltip->win = ewl_window_new(); - ewl_window_title_set(EWL_WINDOW(ewl_attach_tooltip->win), "Tooltip"); - ewl_window_name_set(EWL_WINDOW(ewl_attach_tooltip->win), "Tooltip"); - ewl_window_class_set(EWL_WINDOW(ewl_attach_tooltip->win), "Tooltip"); - ewl_window_transient_for(EWL_WINDOW(emb), EWL_WINDOW(ewl_attach_tooltip->win)); - ewl_window_borderless_set(EWL_WINDOW(ewl_attach_tooltip->win)); - ewl_window_raise(EWL_WINDOW(ewl_attach_tooltip->win)); -#endif /* XXX this should really be in it's own window */ ewl_attach_tooltip->win = ewl_hbox_new(); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_button.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- ewl_button.c 10 Oct 2005 15:27:10 -0000 1.9 +++ ewl_button.c 10 Oct 2005 23:42:20 -0000 1.10 @@ -185,7 +185,7 @@ DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET("b", b, EWL_STOCK_NONE); - DRETURN_INT(b->stock_type, DLEAVE_FUNCTION); + DRETURN_INT(b->stock_type, DLEVEL_STABLE); } /** =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_debug.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ewl_debug.h 30 Jun 2005 19:20:30 -0000 1.4 +++ ewl_debug.h 10 Oct 2005 23:42:20 -0000 1.5 @@ -9,6 +9,8 @@ inline void ewl_print_warning(void); +#define DEBUG 1 + #ifdef DEBUG #define DENTER_FUNCTION(lvl) \ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_entry.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- ewl_entry.c 5 Oct 2005 06:14:06 -0000 1.26 +++ ewl_entry.c 10 Oct 2005 23:42:20 -0000 1.27 @@ -176,7 +176,6 @@ DENTER_FUNCTION(DLEVEL_STABLE); e = EWL_ENTRY(w); - if (!e->editable) { DRETURN(DLEVEL_STABLE); |