From: Hyoyoung Chang <hyoyoung@gmail.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 13 Feb 2012 11:25:23 +0000 (11:25 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 13 Feb 2012 11:25:23 +0000 (11:25 +0000)
Subject: [E-devel] [patch] evas - preventing retard mouse event
process in evas_object_event_callback_call

I made a small patch to prevent retard mouse event process.
At certain circumstance (like as genlist select callback + naviframe
item push),
some events are repeat processed.

If some evas_objects're iterating in evas_event_feed_mouse_up and
mouse_out event's emitted by other interrupt(such as naviframe item
push),
then some evas_objects events are multiple processed by
evas_object_event_callback_call.

More elaborating it with a example.
There are a genlist and a multibuttonentry on genlist item.
When a user clicks multibuttonentry then evas will process mouse down
and up.
in evas_event_feed_mouse_up, it gets evas object list to process mouse
events.
Then in the evas object list, there are two evas objects - rect and
textblock.
Two objects have its own parents.

the rect has below parents.
----------------------------------------
edje  - genlist item
elm_genlist_pan
edje
multibuttonentry
box
entry
els_scroller  (0x2a601788)
rect                                      <== the rect

the textblock has below parents.
----------------------------------------------
edje - genlist item
elm_genlist_pan
edje
multibuttonentry
box
entry
els_scroller(0x2a601788)
edje
elm_pan
edje
textblock                           <== the textblock

(note : two evas object have same parent (els_scroller))

So normally mouse up callbacks event propagates to its own parent.
the rect is processed to genlist item. and the textblock is processed
to genlist item.
but when els_scroller is processed, it's blocked by checking event
type and event id checking.

Mouse Up(rect) ->  Mouse Up(textblock)
event_id (3)      ->   event_id (3)

evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type
type, void *event_info, int event_id)
{
   ...
      if ((obj->delete_me) || (!obj->layer)) return;
         if ((obj->last_event == event_id) &&
                (obj->last_event_type == type)) return;
                     <=== blocked

                     However if naviframe item is pushed in the middle
of mouse up processing.
It can break into mouse up. So it's processed like below.

Mouse Up(rect) -> Mouse Out(rect) -> Mouse Out(textblock) -> Mouse
Up(textblock)
event_id (3)      -> event_id(4)         -> event_id(4)
-> event_id(3)
(note Mouse_Out is made by naviframe item push for event freezing)

If that, there's no mechanism to block that repeat processing same
event.
So I suggest this patch.
This patch blocks old events if there's no reason to process.
(It blocks old mouse_up event because mouse_out is processed.)

And I think it also clear the bug in
"[E-devel] event repetition with elm_naviframe/elm_genlist"

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@67879 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

AUTHORS
src/lib/canvas/evas_callbacks.c

diff --git a/AUTHORS b/AUTHORS
index 470dd6a..eee8e16 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -32,3 +32,4 @@ Youness Alaoui <kakaroto@kakaroto.homelinux.net>
 Jim Kukunas <james.t.kukunas@linux.intel.com>
 Nicolas Aguirre <aguirre.nicolas@gmail.com>
 Rafal Krypa <r.krypa@samsung.com>
+yoyoung Chang <hyoyoung@gmail.com>
index 93f34f2..47cfb0c 100644 (file)
@@ -172,6 +172,15 @@ evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void
    if ((obj->delete_me) || (!obj->layer)) return;
    if ((obj->last_event == event_id) &&
        (obj->last_event_type == type)) return;
+   if (obj->last_event > event_id)
+     {
+        if ((obj->last_event_type == EVAS_CALLBACK_MOUSE_OUT) &&
+            ((type >= EVAS_CALLBACK_MOUSE_DOWN) &&
+             (type <= EVAS_CALLBACK_MULTI_MOVE)))
+          {
+             return;
+          }
+     }
    obj->last_event = event_id;
    obj->last_event_type = type;
    if (!(e = obj->layer->evas)) return;