diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 7b58e5608..a47b26c79 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -389,7 +389,7 @@ static int _e_fm2_cb_live_timer(void *data); static int _e_fm2_theme_edje_object_set(E_Fm2_Smart_Data *sd, Evas_Object *o, const char *category, const char *group); static int _e_fm2_theme_edje_icon_object_set(E_Fm2_Smart_Data *sd, Evas_Object *o, const char *category, const char *group); -static void _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifiers, unsigned int timestamp); +static void _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, void *evas_event); static void _e_fm2_client_spawn(void); static E_Fm2_Client *_e_fm2_client_get(void); @@ -6331,11 +6331,24 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) /* FIXME: prototype */ static void -_e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifiers, unsigned int timestamp) +_e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, void *evas_event) { + Evas_Event_Mouse_Down *ed = NULL; + Evas_Event_Mouse_Up *eu = NULL; + Evas_Modifier *modifiers; int multi_sel = 0, range_sel = 0, sel_change = 0; static unsigned int down_timestamp = 0; + if (!evas_event) return; + + if (!up) { + ed = evas_event; + modifiers = ed->modifiers; + } else { + eu = evas_event; + modifiers = eu->modifiers; + } + if (ic->sd->config->selection.windows_modifiers) { if (evas_key_modifier_is_set(modifiers, "Shift")) @@ -6446,11 +6459,16 @@ _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifiers, unsigne (ic->sd->config->view.single_click) ) { - if (!up && ic->sd->config->view.single_click_delay) - down_timestamp = timestamp; - if (up) { - if ((timestamp - down_timestamp) > ic->sd->config->view.single_click_delay) - evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); + if (ed && ic->sd->config->view.single_click_delay) + down_timestamp = ed->timestamp; + + if (eu && (eu->timestamp - down_timestamp) > ic->sd->config->view.single_click_delay) { + int icon_pos_x = ic->x + ic->sd->x - ic->sd->pos.x; + int icon_pos_y = ic->y + ic->sd->y - ic->sd->pos.y; + + if (eu->output.x >= icon_pos_x && eu->output.x <= (icon_pos_x + ic->w) && + eu->output.y >= icon_pos_y && eu->output.y <= (icon_pos_y + ic->h)) + evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); } } } @@ -6492,11 +6510,11 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf ic->drag.dnd = 0; ic->drag.src = 1; } - _e_fm2_mouse_1_handler(ic, 0, ev->modifiers, ev->timestamp); + _e_fm2_mouse_1_handler(ic, 0, ev); } else if (ev->button == 3) { - if (!ic->selected) _e_fm2_mouse_1_handler(ic, 0, ev->modifiers, ev->timestamp); + if (!ic->selected) _e_fm2_mouse_1_handler(ic, 0, ev); _e_fm2_icon_menu(ic, ic->sd->obj, ev->timestamp); } } @@ -6516,7 +6534,7 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) if ((ev->button == 1) && (!ic->drag.dnd)) { if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)) - _e_fm2_mouse_1_handler(ic, 1, ev->modifiers, ev->timestamp); + _e_fm2_mouse_1_handler(ic, 1, ev); ic->drag.start = 0; ic->drag.dnd = 0; ic->drag.src = 0;