avoid unwanted clicks on touch-screen.

avoiding the un-wanted clicks with touch-screen devices (especially if
they aren't so precise); it basically allows to set a time delay to be
awaited (pressing over an icon) before sending a "selected" callback.

Thanks to this, it could be needed a longer pressure to select an item
in the file-manager; useful for embedded/touch-based systems.

By: Marco Trevisan (Treviño)



SVN revision: 41127
This commit is contained in:
Gustavo Sverzut Barbieri 2009-06-20 15:49:54 +00:00
parent c82f19e052
commit 5fb986a05b
2 changed files with 14 additions and 7 deletions

View File

@ -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);
static void _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifiers, unsigned int timestamp);
static void _e_fm2_client_spawn(void);
static E_Fm2_Client *_e_fm2_client_get(void);
@ -894,6 +894,7 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
sd->config->view.open_dirs_in_place = 1;
sd->config->view.selector = 1;
sd->config->view.single_click = 0;
sd->config->view.single_click_delay = 0;
sd->config->view.no_subdir_jump = 0;
sd->config->icon.icon.w = 128;
sd->config->icon.icon.h = 128;
@ -6330,9 +6331,10 @@ _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)
_e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifiers, unsigned int timestamp)
{
int multi_sel = 0, range_sel = 0, sel_change = 0;
static unsigned int down_timestamp = 0;
if (ic->sd->config->selection.windows_modifiers)
{
@ -6444,8 +6446,12 @@ _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifiers)
(ic->sd->config->view.single_click)
)
{
if (up)
evas_object_smart_callback_call(ic->sd->obj, "selected", NULL);
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);
}
}
}
@ -6486,11 +6492,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);
_e_fm2_mouse_1_handler(ic, 0, ev->modifiers, ev->timestamp);
}
else if (ev->button == 3)
{
if (!ic->selected) _e_fm2_mouse_1_handler(ic, 0, ev->modifiers);
if (!ic->selected) _e_fm2_mouse_1_handler(ic, 0, ev->modifiers, ev->timestamp);
_e_fm2_icon_menu(ic, ic->sd->obj, ev->timestamp);
}
}
@ -6510,7 +6516,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);
_e_fm2_mouse_1_handler(ic, 1, ev->modifiers, ev->timestamp);
ic->drag.start = 0;
ic->drag.dnd = 0;
ic->drag.src = 0;

View File

@ -71,6 +71,7 @@ struct _E_Fm2_Config
unsigned char always_order;
unsigned char link_drop;
unsigned char fit_custom_pos;
unsigned int single_click_delay;
} view;
/* display of icons */
struct {