From 92eb57516c46eca5bf06e32ae943882fdbda7d43 Mon Sep 17 00:00:00 2001 From: hermet Date: Tue, 15 Nov 2011 15:10:19 +0000 Subject: [PATCH] evas/events - removed events_frozen check in evas_event_passes_through() in most cases, it is performed twice inside and outside of the function in inefficient way. and calling of events_frozen in the passes_through() is not understable in the view of functional consistency. Check is separately would be better. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@65269 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/canvas/evas_events.c | 51 +++++++++++---------- src/lib/canvas/evas_object_main.c | 16 ++++--- src/lib/canvas/evas_stack.c | 95 +++++++++++++++++---------------------- src/lib/include/evas_inline.x | 1 - 4 files changed, 76 insertions(+), 87 deletions(-) diff --git a/src/lib/canvas/evas_events.c b/src/lib/canvas/evas_events.c index 6203d59..8077239 100644 --- a/src/lib/canvas/evas_events.c +++ b/src/lib/canvas/evas_events.c @@ -111,7 +111,7 @@ evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y) Evas_Layer *lay; Eina_List *in = NULL; - if (!e->layers) return NULL; + if ((!e->layers) || (e->events_frozen > 0)) return NULL; EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay) { int norep = 0; @@ -575,18 +575,18 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const { ev.cur.canvas.x = e->pointer.x; ev.cur.canvas.y = e->pointer.y; - _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed); - if (((evas_object_clippers_is_visible(obj)) || - (obj->mouse_grabbed)) && + _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, + &ev.cur.canvas.y, + obj->mouse_grabbed); + if ((e->events_frozen <= 0) && + (evas_object_clippers_is_visible(obj) || + obj->mouse_grabbed) && (!evas_event_passes_through(obj)) && (!evas_event_freezes_through(obj)) && (!obj->clip.clipees)) { if ((px != x) || (py != y)) - { - if (e->events_frozen <= 0) - evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev); - } + evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev); } else outs = eina_list_append(outs, obj); @@ -695,23 +695,23 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const /* in list */ // FIXME: i don't think we need this // evas_object_clip_recalc(obj); - if (evas_object_is_in_output_rect(obj, x, y, 1, 1) && - ((evas_object_clippers_is_visible(obj)) || - (obj->mouse_grabbed)) && - (eina_list_data_find(ins, obj)) && + if ((e->events_frozen <= 0) && + evas_object_is_in_output_rect(obj, x, y, 1, 1) && + (evas_object_clippers_is_visible(obj) || + obj->mouse_grabbed) && + eina_list_data_find(ins, obj) && (!evas_event_passes_through(obj)) && (!evas_event_freezes_through(obj)) && (!obj->clip.clipees) && - ((!obj->precise_is_inside) || - (evas_object_is_inside(obj, x, y)))) + ((!obj->precise_is_inside) || evas_object_is_inside(obj, x, y)) + ) { if ((px != x) || (py != y)) { ev.cur.canvas.x = e->pointer.x; ev.cur.canvas.y = e->pointer.y; _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed); - if (e->events_frozen <= 0) - evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev); + evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev); } } /* otherwise it has left the object */ @@ -1087,8 +1087,8 @@ evas_event_feed_multi_move(Evas *e, copy = evas_event_list_copy(e->pointer.object.in); EINA_LIST_FOREACH(copy, l, obj) { - if (((evas_object_clippers_is_visible(obj)) || - (obj->mouse_grabbed)) && + if ((e->events_frozen <= 0) && + (evas_object_clippers_is_visible(obj) || obj->mouse_grabbed) && (!evas_event_passes_through(obj)) && (!evas_event_freezes_through(obj)) && (!obj->clip.clipees)) @@ -1102,7 +1102,6 @@ evas_event_feed_multi_move(Evas *e, ev.cur.canvas.xsub = ev.cur.canvas.x; // fixme - lost precision if (y != ev.cur.canvas.y) ev.cur.canvas.ysub = ev.cur.canvas.y; // fixme - lost precision - if (e->events_frozen <= 0) evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_MOVE, &ev); } if (e->delete_me) break; @@ -1146,15 +1145,16 @@ evas_event_feed_multi_move(Evas *e, /* in list */ // FIXME: i don't think we need this // evas_object_clip_recalc(obj); - if (evas_object_is_in_output_rect(obj, x, y, 1, 1) && - ((evas_object_clippers_is_visible(obj)) || - (obj->mouse_grabbed)) && - (eina_list_data_find(ins, obj)) && + if ((e->events_frozen <= 0) && + evas_object_is_in_output_rect(obj, x, y, 1, 1) && + (evas_object_clippers_is_visible(obj) || + obj->mouse_grabbed) && + eina_list_data_find(ins, obj) && (!evas_event_passes_through(obj)) && (!evas_event_freezes_through(obj)) && (!obj->clip.clipees) && - ((!obj->precise_is_inside) || - (evas_object_is_inside(obj, x, y)))) + ((!obj->precise_is_inside) || evas_object_is_inside(obj, x, y)) + ) { ev.cur.canvas.x = x; ev.cur.canvas.y = y; @@ -1165,7 +1165,6 @@ evas_event_feed_multi_move(Evas *e, ev.cur.canvas.xsub = ev.cur.canvas.x; // fixme - lost precision if (y != ev.cur.canvas.y) ev.cur.canvas.ysub = ev.cur.canvas.y; // fixme - lost precision - if (e->events_frozen <= 0) evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_MOVE, &ev); } if (e->delete_me) break; diff --git a/src/lib/canvas/evas_object_main.c b/src/lib/canvas/evas_object_main.c index 34de412..3eaded9 100644 --- a/src/lib/canvas/evas_object_main.c +++ b/src/lib/canvas/evas_object_main.c @@ -1130,7 +1130,8 @@ evas_object_top_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Eina_Bool i EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj) { if (obj->delete_me) continue; - if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue; + if ((!include_pass_events_objects) && + (evas_event_passes_through(obj))) continue; if ((!include_hidden_objects) && (!obj->cur.visible)) continue; evas_object_clip_recalc(obj); if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) && @@ -1144,8 +1145,8 @@ evas_object_top_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Eina_Bool i EAPI Evas_Object * evas_object_top_at_pointer_get(const Evas *e) { -//// return evas_object_top_at_xy_get(e, e->pointer.canvas_x, e->pointer.canvas_y, 0, 0); - return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, 1, 1); + return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, EINA_TRUE, + EINA_TRUE); } EAPI Evas_Object * @@ -1174,7 +1175,8 @@ evas_object_top_in_rectangle_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj) { if (obj->delete_me) continue; - if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue; + if ((!include_pass_events_objects) && + (evas_event_passes_through(obj))) continue; if ((!include_hidden_objects) && (!obj->cur.visible)) continue; evas_object_clip_recalc(obj); if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) && @@ -1206,7 +1208,8 @@ evas_objects_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Eina_Bool incl EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj) { if (obj->delete_me) continue; - if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue; + if ((!include_pass_events_objects) && + (evas_event_passes_through(obj))) continue; if ((!include_hidden_objects) && (!obj->cur.visible)) continue; evas_object_clip_recalc(obj); if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) && @@ -1256,7 +1259,8 @@ evas_objects_in_rectangle_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Co EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj) { if (obj->delete_me) continue; - if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue; + if ((!include_pass_events_objects) && + (evas_event_passes_through(obj))) continue; if ((!include_hidden_objects) && (!obj->cur.visible)) continue; evas_object_clip_recalc(obj); if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) && diff --git a/src/lib/canvas/evas_stack.c b/src/lib/canvas/evas_stack.c index 8ab6e80..a8dec0d 100644 --- a/src/lib/canvas/evas_stack.c +++ b/src/lib/canvas/evas_stack.c @@ -54,8 +54,7 @@ evas_object_raise(Evas_Object *obj) else { if (obj->in_layer) - obj->layer->objects = (Evas_Object *)eina_inlist_demote(EINA_INLIST_GET(obj->layer->objects), - EINA_INLIST_GET(obj)); + obj->layer->objects = (Evas_Object *)eina_inlist_demote(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj)); } if (obj->clip.clipees) { @@ -66,23 +65,20 @@ evas_object_raise(Evas_Object *obj) obj->restack = EINA_TRUE; evas_object_change(obj); evas_object_inform_call_restack(obj); - if (obj->layer->evas->events_frozen <= 0) + if (obj->layer->evas->events_frozen > 0) return; + if ((!evas_event_passes_through(obj)) && (!evas_event_freezes_through(obj))) { - if ((!evas_event_passes_through(obj)) && - (!evas_event_freezes_through(obj))) + if (!obj->smart.smart) { - if (!obj->smart.smart) - { - if (evas_object_is_in_output_rect(obj, - obj->layer->evas->pointer.x, - obj->layer->evas->pointer.y, 1, 1) && - obj->cur.visible) - evas_event_feed_mouse_move(obj->layer->evas, + if (evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, - obj->layer->evas->last_timestamp, - NULL); - } + 1, 1) && obj->cur.visible) + evas_event_feed_mouse_move(obj->layer->evas, + obj->layer->evas->pointer.x, + obj->layer->evas->pointer.y, + obj->layer->evas->last_timestamp, + NULL); } } } @@ -116,23 +112,20 @@ evas_object_lower(Evas_Object *obj) obj->restack = EINA_TRUE; evas_object_change(obj); evas_object_inform_call_restack(obj); - if (obj->layer->evas->events_frozen <= 0) + if (obj->layer->evas->events_frozen > 0) return; + if ((!evas_event_passes_through(obj)) && (!evas_event_freezes_through(obj))) { - if ((!evas_event_passes_through(obj)) && - (!evas_event_freezes_through(obj))) + if (!obj->smart.smart) { - if (!obj->smart.smart) - { - if (evas_object_is_in_output_rect(obj, - obj->layer->evas->pointer.x, - obj->layer->evas->pointer.y, 1, 1) && - obj->cur.visible) - evas_event_feed_mouse_move(obj->layer->evas, + if (evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, - obj->layer->evas->last_timestamp, - NULL); - } + 1, 1) && obj->cur.visible) + evas_event_feed_mouse_move(obj->layer->evas, + obj->layer->evas->pointer.x, + obj->layer->evas->pointer.y, + obj->layer->evas->last_timestamp, + NULL); } } } @@ -197,23 +190,20 @@ evas_object_stack_above(Evas_Object *obj, Evas_Object *above) obj->restack = EINA_TRUE; evas_object_change(obj); evas_object_inform_call_restack(obj); - if (obj->layer->evas->events_frozen <= 0) + if (obj->layer->evas->events_frozen > 0) return; + if ((!evas_event_passes_through(obj)) && (!evas_event_freezes_through(obj))) { - if ((!evas_event_passes_through(obj)) && - (!evas_event_freezes_through(obj))) + if (!obj->smart.smart) { - if (!obj->smart.smart) - { - if (evas_object_is_in_output_rect(obj, - obj->layer->evas->pointer.x, - obj->layer->evas->pointer.y, 1, 1) && - obj->cur.visible) - evas_event_feed_mouse_move(obj->layer->evas, + if (evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, - obj->layer->evas->last_timestamp, - NULL); - } + 1, 1) && obj->cur.visible) + evas_event_feed_mouse_move(obj->layer->evas, + obj->layer->evas->pointer.x, + obj->layer->evas->pointer.y, + obj->layer->evas->last_timestamp, + NULL); } } } @@ -278,23 +268,20 @@ evas_object_stack_below(Evas_Object *obj, Evas_Object *below) obj->restack = EINA_TRUE; evas_object_change(obj); evas_object_inform_call_restack(obj); - if (obj->layer->evas->events_frozen <= 0) + if (obj->layer->evas->events_frozen > 0) return; + if ((!evas_event_passes_through(obj)) && (!evas_event_freezes_through(obj))) { - if ((!evas_event_passes_through(obj)) && - (!evas_event_freezes_through(obj))) + if (!obj->smart.smart) { - if (!obj->smart.smart) - { - if (evas_object_is_in_output_rect(obj, - obj->layer->evas->pointer.x, - obj->layer->evas->pointer.y, 1, 1) && - obj->cur.visible) - evas_event_feed_mouse_move(obj->layer->evas, + if (evas_object_is_in_output_rect(obj, obj->layer->evas->pointer.x, obj->layer->evas->pointer.y, - obj->layer->evas->last_timestamp, - NULL); - } + 1, 1) && obj->cur.visible) + evas_event_feed_mouse_move(obj->layer->evas, + obj->layer->evas->pointer.x, + obj->layer->evas->pointer.y, + obj->layer->evas->last_timestamp, + NULL); } } } diff --git a/src/lib/include/evas_inline.x b/src/lib/include/evas_inline.x index 49523e6..45f2b1f 100644 --- a/src/lib/include/evas_inline.x +++ b/src/lib/include/evas_inline.x @@ -86,7 +86,6 @@ evas_event_freezes_through(Evas_Object *obj) static inline int evas_event_passes_through(Evas_Object *obj) { - if (obj->layer->evas->events_frozen > 0) return 1; if (obj->pass_events) return 1; if (obj->parent_cache.pass_events_valid) return obj->parent_cache.pass_events; -- 2.7.4