evas: consider clipper when handling mouse event 08/127208/1
authorJaeun Choi <jaeun12.choi@samsung.com>
Wed, 26 Apr 2017 11:27:14 +0000 (20:27 +0900)
committerJaeun Choi <jaeun12.choi@samsung.com>
Wed, 26 Apr 2017 11:27:56 +0000 (20:27 +0900)
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: I385552a44c2e4424c7f5104e70d14c5d0d410d1b

src/lib/evas/canvas/evas_events.c

index 174a88a..93c118a 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,7 @@ _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,6 +79,31 @@ _evas_event_object_list_raw_in_get(Evas *eo_e, Eina_List *in,
              *no_rep = 1;
              return in;
           }
+        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);
+
+        if ((!RECTS_INTERSECT(x, y, 1, 1, c.x, c.y, c.w, c.h))) continue;
+
         if (evas_event_passes_through(eo_obj, obj)) continue;
         if (!source)
           {