elm_code: Fix click calculations.

We must take into account our scroll position and also where we are positioned
within the screen layout
This commit is contained in:
Andy Williams 2015-01-28 22:38:49 +00:00
parent ae12a8406c
commit 155c18c141
1 changed files with 5 additions and 3 deletions

View File

@ -313,14 +313,16 @@ _elm_code_widget_clicked_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EI
Elm_Code_Widget *widget;
Elm_Code_Widget_Data *pd;
Evas_Event_Mouse_Up *event;
Evas_Coord x, y;
Evas_Coord x, y, ox, oy, sx, sy;
widget = (Elm_Code_Widget *)data;
pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
event = (Evas_Event_Mouse_Up *)event_info;
x = event->canvas.x;
y = event->canvas.y;
evas_object_geometry_get(widget, &ox, &oy, NULL, NULL);
elm_scroller_region_get(pd->scroller, &sx, &sy, NULL, NULL);
x = event->canvas.x + sx - ox;
y = event->canvas.y + sy - oy;
if (pd->editable)
_elm_code_widget_clicked_editable_cb(widget, x, y);