From 0c74d1c82d77b80d038d8cf051809348b6f54e02 Mon Sep 17 00:00:00 2001 From: Hyoyoung Chang Date: Mon, 13 Feb 2012 11:25:23 +0000 Subject: [PATCH] From: Hyoyoung Chang 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" SVN revision: 67879 --- legacy/evas/AUTHORS | 1 + legacy/evas/src/lib/canvas/evas_callbacks.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/legacy/evas/AUTHORS b/legacy/evas/AUTHORS index 470dd6a0f6..eee8e16137 100644 --- a/legacy/evas/AUTHORS +++ b/legacy/evas/AUTHORS @@ -32,3 +32,4 @@ Youness Alaoui Jim Kukunas Nicolas Aguirre Rafal Krypa +yoyoung Chang diff --git a/legacy/evas/src/lib/canvas/evas_callbacks.c b/legacy/evas/src/lib/canvas/evas_callbacks.c index 93f34f2376..47cfb0c4e4 100644 --- a/legacy/evas/src/lib/canvas/evas_callbacks.c +++ b/legacy/evas/src/lib/canvas/evas_callbacks.c @@ -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;