evas: Fix missing case when check the event area 57/151757/2
authorjiin.moon <jiin.moon@samsung.com>
Fri, 22 Sep 2017 00:55:09 +0000 (09:55 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 17 Oct 2017 09:03:33 +0000 (09:03 +0000)
This patch inclues two commits

1) Fix missing case when check the event area
this commit from upstream patch
commit 4f8fe4889f7446664a13d9bbd6da76bcbbc98501
======================================================================
Summary:
If the object is outside the parent geometry because of map,
this object would be ignored in determining object is in the event area.

  Please refer to below case
  1) There are some button in the box object
  2) A button has map with 90 degree.
     It would be placed outside the box geometry
  3) If you press the button part outside the box,
     the button event does not work.

    Test Plan: sample code

    Reviewers: jpeg, cedric

    Differential Revision: https://phab.enlightenment.org/D5180
=======================================================================

2) evas: conside clipper when handling mouse evetn
This commit was reverted commit from tizne branch because side-effect.
commit 36cf654e126d7328d54b61b103fe84236d9a5a4c
Now the side-effect issue is fixed by 1) commit.
=======================================================================
Summary:
when an object is clipped,
mouse event area should be clipped as well.

this commit comes from upstream patches
f6b3c31561276a6c7afc8fb56ae2e5363772782c: basic logic for clipper
afbe8ade6b7f99d5158be931a13971bb0681509f: added logic for mapped objects
========================================================================

Change-Id: I4c65d5c28783629e71b0a840d5d11f4fe7a683b2

src/lib/evas/canvas/evas_events.c

index e1a4eea..8251515 100644 (file)
@@ -48,6 +48,16 @@ _evas_event_havemap_is_in_output_rect(Evas_Object *eo_obj, Evas_Object_Protected
    return 0;
 }
 
+static void
+clip_calc(Evas_Object_Protected_Data *obj, Evas_Coord_Rectangle *c)
+{
+   if (!obj) return;
+   RECTS_CLIP_TO_RECT(c->x, c->y, c->w, c->h,
+                      obj->cur->geometry.x, obj->cur->geometry.y,
+                      obj->cur->geometry.w, obj->cur->geometry.h);
+   clip_calc(obj->cur->clipper, c);
+}
+
 static Eina_List *
 _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
                                    const Eina_Inlist *list, Evas_Object *stop,
@@ -55,6 +65,8 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
 {
    Evas_Object *eo_obj;
    Evas_Object_Protected_Data *obj = NULL;
+   Evas_Coord_Rectangle c;
+
    int inside;
 
    if (!list) return in;
@@ -68,10 +80,37 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
              *no_rep = 1;
              return in;
           }
-        if (evas_event_passes_through(eo_obj, obj)) continue;
+        if (!obj->cur->visible) continue;
+
+        if (EINA_UNLIKELY((!!obj->map) && (obj->map->cur.map)
+                          && (obj->map->cur.usemap)))
+          c = obj->map->cur.map->normal_geometry;
+        else
+          {
+             if (obj->is_smart)
+               {
+                  Evas_Coord_Rectangle bounding_box = { 0, 0, 0, 0};
+
+                  evas_object_smart_bounding_box_update(eo_obj, obj);
+                  evas_object_smart_bounding_box_get(eo_obj, &bounding_box, NULL);
+                  c = bounding_box;
+               }
+             else
+               {
+                  if (obj->clip.clipees) continue;
+                  c = obj->cur->geometry;
+               }
+          }
+        clip_calc(obj->cur->clipper, &c);
+        // only worry about objects that intersect INCLUDING clippint
+        if ((!RECTS_INTERSECT(x, y, 1, 1, c.x, c.y, c.w, c.h)) && (!obj->child_has_map))
+          continue;
+
         if (!source)
           {
              if (evas_object_is_source_invisible(eo_obj, obj)) continue;
+             if (evas_event_passes_through(eo_obj, obj)) continue;
+
           }
         if ((obj->delete_me == 0) &&
             ((source) || ((obj->cur->visible) && (!obj->clip.clipees) &&