From 1da8387c2fa174f88d463eba8c6f04a8e1c3cfc8 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 25 Apr 2013 11:48:01 +0100 Subject: [PATCH] improve efm mouse move detection (no more tooltips when cursor is in separate window) --- ChangeLog | 4 ++++ NEWS | 18 ++++++++++++++++ src/bin/e_fm.c | 56 ++++++++++++++++++++++++++++++++------------------ 3 files changed, 58 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 507757cae..0a893f802 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-25 Mike Blumenkrantz + + * improve efm mouse movement detection for icons + 2013-04-09 Rafael Antognolli * 0.17.2.1 release diff --git a/NEWS b/NEWS index 805b5200e..c9b0d13b5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,21 @@ +Changes since 0.17.2: +--------------------- + +Additions: + +Deprecations: + +Changes: + +Removed: + +Improvements: + * improve efm mouse movement detection for icons + +Fixes: + + + Changes since 0.17.1: --------------------- diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index ff7bc88a8..26248e191 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -182,7 +182,7 @@ struct _E_Fm2_Icon E_Fm2_Smart_Data *sd; E_Fm2_Region *region; Evas_Coord x, y, w, h, min_w, min_h; - Evas_Object *obj, *obj_icon; + Evas_Object *obj, *obj_icon, *rect; E_Menu *menu; E_Entry_Dialog *entry_dialog; Evas_Object *entry_widget; @@ -4762,13 +4762,20 @@ _e_fm2_icon_label_click(void *data, Evas_Object *obj __UNUSED__, const char *emi static void _e_fm2_icon_realize(E_Fm2_Icon *ic) { + Evas *e; + if (ic->realized) return; + e = evas_object_evas_get(ic->sd->obj); /* actually create evas objects etc. */ ic->realized = EINA_TRUE; - evas_event_freeze(evas_object_evas_get(ic->sd->obj)); - ic->obj = edje_object_add(evas_object_evas_get(ic->sd->obj)); + evas_event_freeze(e); + ic->obj = edje_object_add(e); edje_object_freeze(ic->obj); evas_object_smart_member_add(ic->obj, ic->sd->obj); + ic->rect = evas_object_rectangle_add(e); + evas_object_color_set(ic->rect, 0, 0, 0, 0); + evas_object_smart_member_add(ic->rect, ic->sd->obj); + evas_object_repeat_events_set(ic->rect, 1); evas_object_stack_below(ic->obj, ic->sd->drop); if (_e_fm2_view_mode_get(ic->sd) == E_FM2_VIEW_MODE_LIST) { @@ -4815,25 +4822,31 @@ _e_fm2_icon_realize(E_Fm2_Icon *ic) "base/theme/fileman", "icon/variable"); } + evas_object_stack_above(ic->rect, ic->obj); _e_fm2_icon_label_set(ic, ic->obj); evas_object_clip_set(ic->obj, ic->sd->clip); evas_object_move(ic->obj, ic->sd->x + ic->x - ic->sd->pos.x, ic->sd->y + ic->y - ic->sd->pos.y); + evas_object_move(ic->rect, + ic->sd->x + ic->x - ic->sd->pos.x, + ic->sd->y + ic->y - ic->sd->pos.y); evas_object_resize(ic->obj, ic->w, ic->h); + evas_object_resize(ic->rect, ic->w, ic->h); - evas_object_event_callback_add(ic->obj, EVAS_CALLBACK_MOUSE_DOWN, _e_fm2_cb_icon_mouse_down, ic); - evas_object_event_callback_add(ic->obj, EVAS_CALLBACK_MOUSE_UP, _e_fm2_cb_icon_mouse_up, ic); - evas_object_event_callback_add(ic->obj, EVAS_CALLBACK_MOUSE_MOVE, _e_fm2_cb_icon_mouse_move, ic); - evas_object_event_callback_add(ic->obj, EVAS_CALLBACK_MOUSE_IN, _e_fm2_cb_icon_mouse_in, ic); - evas_object_event_callback_add(ic->obj, EVAS_CALLBACK_MOUSE_OUT, _e_fm2_cb_icon_mouse_out, ic); + evas_object_event_callback_add(ic->rect, EVAS_CALLBACK_MOUSE_DOWN, _e_fm2_cb_icon_mouse_down, ic); + evas_object_event_callback_add(ic->rect, EVAS_CALLBACK_MOUSE_UP, _e_fm2_cb_icon_mouse_up, ic); + evas_object_event_callback_add(ic->rect, EVAS_CALLBACK_MOUSE_MOVE, _e_fm2_cb_icon_mouse_move, ic); + evas_object_event_callback_add(ic->rect, EVAS_CALLBACK_MOUSE_IN, _e_fm2_cb_icon_mouse_in, ic); + evas_object_event_callback_add(ic->rect, EVAS_CALLBACK_MOUSE_OUT, _e_fm2_cb_icon_mouse_out, ic); edje_object_signal_callback_add(ic->obj, "e,action,label,click", "e", _e_fm2_icon_label_click, ic); _e_fm2_icon_icon_set(ic); edje_object_thaw(ic->obj); - evas_event_thaw(evas_object_evas_get(ic->sd->obj)); + evas_event_thaw(e); evas_object_show(ic->obj); + evas_object_show(ic->rect); if (ic->selected) { @@ -4869,6 +4882,8 @@ _e_fm2_icon_unrealize(E_Fm2_Icon *ic) ic->realized = EINA_FALSE; evas_object_del(ic->obj); ic->obj = NULL; + evas_object_del(ic->rect); + ic->rect = NULL; evas_object_del(ic->obj_icon); ic->obj_icon = NULL; } @@ -5194,7 +5209,10 @@ _e_fm2_region_realize(E_Fm2_Region *rg) EINA_LIST_FOREACH(rg->list, l, ic) { if (ic->selected) - evas_object_stack_below(ic->obj, ic->sd->drop); + { + evas_object_stack_below(ic->obj, ic->sd->drop); + evas_object_stack_above(ic->rect, ic->obj); + } } edje_thaw(); } @@ -6191,6 +6209,7 @@ _e_fm2_dnd_finish(Evas_Object *obj, int refresh) ic->drag.src = EINA_FALSE; if (ic->drag.hidden) continue; if (ic->obj) evas_object_show(ic->obj); + if (ic->rect) evas_object_show(ic->rect); if (ic->obj_icon) evas_object_show(ic->obj_icon); } if (refresh) e_fm2_refresh(obj); @@ -7237,7 +7256,6 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE ic = data; ev = event_info; - edje_object_message_signal_process(ic->obj); edje_object_message_signal_process(ic->obj); _e_fm2_typebuf_hide(ic->sd->obj); @@ -7259,6 +7277,7 @@ _e_fm2_cb_drag_finished_show(E_Fm2_Icon *ic) { ic->drag.dnd = ic->drag.src = EINA_FALSE; if (ic->obj) evas_object_show(ic->obj); + if (ic->rect) evas_object_show(ic->rect); if (ic->obj_icon) evas_object_show(ic->obj_icon); ic->drag.dnd_end_timer = NULL; return EINA_FALSE; @@ -7393,15 +7412,6 @@ _e_fm2_cb_icon_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS ev = event_info; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; - /* here we have some stupid checks to see if we're REALLY getting a mouse out or - * if some jackass is sending us bad events - * ticket #1324 - */ - if (E_INSIDE(ev->output.x, ev->output.y - 10, ic->sd->x + ic->x - ic->sd->pos.x, ic->sd->y + ic->y - ic->sd->pos.y, ic->w, ic->h) && - E_INSIDE(ev->output.x - 10, ev->output.y, ic->sd->x + ic->x - ic->sd->pos.x, ic->sd->y + ic->y - ic->sd->pos.y, ic->w, ic->h) && - E_INSIDE(ev->output.x + 10, ev->output.y, ic->sd->x + ic->x - ic->sd->pos.x, ic->sd->y + ic->y - ic->sd->pos.y, ic->w, ic->h) && - E_INSIDE(ev->output.x, ev->output.y + 10, ic->sd->x + ic->x - ic->sd->pos.x, ic->sd->y + ic->y - ic->sd->pos.y, ic->w, ic->h) && - evas_pointer_inside_get(evas_object_evas_get(ic->sd->obj))) return; evas_object_smart_callback_call(ic->sd->obj, "icon_mouse_out", &ic->info); } @@ -7466,6 +7476,7 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU ic->sd->drag = EINA_TRUE; ic->drag.dnd = EINA_TRUE; if (ic->obj) evas_object_hide(ic->obj); + if (ic->rect) evas_object_hide(ic->rect); if (ic->obj_icon) evas_object_hide(ic->obj_icon); ic->drag.start = EINA_FALSE; evas_object_geometry_get(ic->obj, &x, &y, &w, &h); @@ -7507,6 +7518,7 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU ici->ic->drag.dnd = EINA_TRUE; if (ici->ic->obj) evas_object_hide(ici->ic->obj); + if (ici->ic->rect) evas_object_hide(ici->ic->rect); if (ici->ic->obj_icon) evas_object_hide(ici->ic->obj_icon); } if (!sel) return; @@ -8285,7 +8297,11 @@ _e_fm2_obj_icons_place(E_Fm2_Smart_Data *sd) evas_object_move(ic->obj, sd->x + ic->x - sd->pos.x, sd->y + ic->y - sd->pos.y); + evas_object_move(ic->rect, + sd->x + ic->x - sd->pos.x, + sd->y + ic->y - sd->pos.y); evas_object_resize(ic->obj, ic->w, ic->h); + evas_object_resize(ic->rect, ic->w, ic->h); _e_fm2_icon_thumb(ic, ic->obj_icon, 0); if (_e_fm2_view_mode_get(ic->sd) != E_FM2_VIEW_MODE_LIST) continue; /* FIXME: this is probably something that should be unnecessary,