From 9cf4d766abd87da2467aea2b1a0623dacc6a372c Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Tue, 13 Nov 2012 10:15:29 +0000 Subject: [PATCH] evas/map - Don't extrapolate outside coords unsafely from map_coords_get() Don't know why is it actually needed. SVN revision: 79214 --- src/lib/evas/canvas/evas_events.c | 4 +++- src/lib/evas/canvas/evas_map.c | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c index b28dcadff1..01f7cd0fa0 100644 --- a/src/lib/evas/canvas/evas_events.c +++ b/src/lib/evas/canvas/evas_events.c @@ -22,7 +22,9 @@ _evas_event_havemap_adjust(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protecte if ((!obj->cur.usemap) || (!obj->cur.map) || (!obj->cur.map->count == 4)) return; - if(evas_map_coords_get(obj->cur.map, *x, *y, x, y, mouse_grabbed)) + //FIXME: Unless map_coords_get() supports grab mode and extrapolate coords + //outside map, this should check the return value for outside case. + if (evas_map_coords_get(obj->cur.map, *x, *y, x, y, mouse_grabbed)) { *x += obj->cur.geometry.x; *y += obj->cur.geometry.y; diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c index 69f38171d0..bf5b0760d6 100644 --- a/src/lib/evas/canvas/evas_map.c +++ b/src/lib/evas/canvas/evas_map.c @@ -228,8 +228,12 @@ evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, MAGIC_CHECK_END(); if (m->count < 4) return EINA_FALSE; - if ((!mx) && (!my)) - return evas_map_inside_get(m, x, y); + + Eina_Bool inside = evas_map_inside_get(m, x, y); + if ((!mx) && (!my)) return inside; + + // FIXME: need to handle grab mode and extrapolate coords outside map + if (grab && !inside) return EINA_FALSE; int i, j, edges, edge[m->count][2]; Eina_Bool douv = EINA_FALSE; @@ -237,8 +241,7 @@ evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, double u[2] = { 0.0, 0.0 }; double v[2] = { 0.0, 0.0 }; - // FIXME need to handle grab mode and extrapolte coords outside - // map +/* if (grab) { Evas_Coord ymin, ymax; @@ -253,6 +256,7 @@ evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, if (y <= ymin) y = ymin + 1; if (y >= ymax) y = ymax - 1; } +*/ edges = EINA_FALSE; for (i = 0; i < m->count; i++) { @@ -348,7 +352,8 @@ evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, } return EINA_TRUE; } - if (grab) +/* + if (grab) { if (douv) { @@ -361,6 +366,7 @@ evas_map_coords_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y, } return EINA_TRUE; } +*/ } return EINA_FALSE; }