Here's another patch I've made for efm2 to fix an issue that I've often
experienced using it (in Illume) with a touch-screen device (Freerunner).
It often happens a very strange thing: I try to finger-scroll a bottom
icon (it must be on the latest row) moving my thumb up, well... The the
scroller doesn't scroll, but wherever and whenever I release my finger,
the selected icon is executed!

I don't really know to what is this due (the touchscreen seems to
perform correctly by the way), but I've never been able to replicate it
using a mouse in my PC.

Anyway to fix this issue, that could be specific, I've used a workaround
that I think that could be applied for all: it basically checks if the
mouse has been released in the area where the clicked icon is, before
sending a "selected" callback.

It needs the previously attached e_fm2-single-click-delay-support.patch
to be applied correctly.

Going deeply into the real issue I've made some tests, and I got that
this seems mostly due to an evas issue (I figure), since the e_fm2's
scrollframe never sets the evas event flag to: EVAS_EVENT_FLAG_ON_HOLD
(that would avoid the un-wanted click).
After some debugging there, I've also seen that in this very particular
buggy case the _e_smart_event_mouse_up() and _e_smart_event_mouse_move()
callback functions are never called (so I figure that evas doesn't add
the callbacks at all for the scrollframe, while they are added in the
e_fm2).

Let me know what you think about this... I thing that the Om users would
need a fix like this.

-- 
Treviño's World - Life and Linux
http://www.3v1n0.net/
>From 6e5d6718a0ca7d9182dd44fa58aa340a6ea880cf Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Trevi=C3=B1o=20-=203v1n0?= <[email protected]>
Date: Tue, 9 Jun 2009 02:08:29 +0200
Subject: [PATCH] e_fm2 avoid invalid clicks
 This patch checks that the mouse pointer is still over a previously
 clicked icon area when the mouse-up event occurs before sending the
 "selected" callback.

---
 src/bin/e_fm.c |   38 +++++++++++++++++++++++++++++---------
 1 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c
index 7b58e56..47fcc39 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,18 @@ _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 (ed) {
+	  if (ic->sd->config->view.single_click_delay)
+	    down_timestamp = ed->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 (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 +6512,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 +6536,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;
-- 
1.6.3.rc0

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to