From 8fb194d969ccb9227e56ea60f538d977393408d7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Fri, 15 Sep 2017 12:14:32 +0900 Subject: [PATCH] efl: Use Eina.Position2D for Efl.Gfx.position Note: This is a little bit more cumbersome in some places but in most it's more convenient than (x,y). --- src/bin/elementary/test_events.c | 15 +++--- src/bin/elementary/test_photocam.c | 2 +- src/bin/elementary/test_scroller.c | 4 +- src/bin/elementary/test_ui_grid.c | 23 +++++---- src/examples/evas/evas-3d-proxy.c | 2 +- .../evas/evas-object-manipulation-eo.c | 8 ++-- src/lib/edje/edje_calc.c | 10 ++-- src/lib/edje/edje_smart.c | 12 ++--- src/lib/edje/edje_text.c | 5 +- src/lib/efl/interfaces/efl_gfx.eo | 11 +++-- src/lib/eina/eina_rectangle.h | 5 +- src/lib/elementary/efl_ui_grid_static.c | 16 +++---- src/lib/elementary/efl_ui_image.c | 12 ++--- src/lib/elementary/efl_ui_image_zoomable.c | 15 +++--- src/lib/elementary/efl_ui_text.c | 9 ++-- src/lib/elementary/efl_ui_textpath.c | 47 +++++++++---------- src/lib/elementary/efl_ui_win.c | 38 +++++++-------- src/lib/elementary/elm_diskselector.c | 9 ++-- src/lib/elementary/elm_entry.c | 9 ++-- src/lib/elementary/elm_gengrid.c | 15 +++--- src/lib/elementary/elm_genlist.c | 15 +++--- src/lib/elementary/elm_hover.c | 8 ++-- src/lib/elementary/elm_interface_scrollable.c | 10 ++-- src/lib/elementary/elm_list.c | 9 ++-- src/lib/elementary/elm_map.c | 15 +++--- src/lib/elementary/elm_mapbuf.c | 6 +-- src/lib/elementary/elm_menu.c | 15 +++--- src/lib/elementary/elm_notify.c | 14 +++--- src/lib/elementary/elm_panel.c | 9 ++-- src/lib/elementary/elm_scroller.c | 9 ++-- src/lib/elementary/elm_toolbar.c | 9 ++-- src/lib/elementary/elm_widget.c | 10 ++-- src/lib/emotion/emotion_smart.c | 8 ++-- .../canvas/efl_canvas_object_event_grabber.c | 6 +-- src/lib/evas/canvas/evas_object_box.c | 6 +-- src/lib/evas/canvas/evas_object_main.c | 37 ++++++--------- src/lib/evas/canvas/evas_object_smart.c | 8 ++-- src/lib/evas/canvas/evas_object_table.c | 6 +-- src/lib/evas/canvas/evas_object_textblock.c | 16 +++---- src/lib/evas/canvas/evas_vg_node.c | 27 +++++------ src/tests/emotion/emotion_test_main-eo.c | 13 +++-- 41 files changed, 254 insertions(+), 269 deletions(-) diff --git a/src/bin/elementary/test_events.c b/src/bin/elementary/test_events.c index 013bd91cd5..8a10403c52 100644 --- a/src/bin/elementary/test_events.c +++ b/src/bin/elementary/test_events.c @@ -111,18 +111,17 @@ _clicked_button2(void *data, const Efl_Event *ev EINA_UNUSED) { testdata *td = data; Eo *bt = td->button; - int x, y, w, h; + Eina_Rect r; if (!td->evkeyup) { - efl_gfx_position_get(bt, &x, &y); - efl_gfx_size_get(bt, &w, &h); + r = efl_gfx_geometry_get(bt); - x = x + w / 2; - y = y + h / 2; - efl_input_pointer_position_set(td->evmove, x, y); - efl_input_pointer_position_set(td->evdown, x, y); - efl_input_pointer_position_set(td->evup, x, y); + r.x = r.x + r.w / 2; + r.y = r.y + r.h / 2; + efl_input_pointer_position_set(td->evmove, r.x, r.y); + efl_input_pointer_position_set(td->evdown, r.x, r.y); + efl_input_pointer_position_set(td->evup, r.x, r.y); efl_event_callback_call(td->win, EFL_EVENT_POINTER_MOVE, td->evmove); efl_event_callback_call(td->win, EFL_EVENT_POINTER_DOWN, td->evdown); diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index 4e25fdd45f..25d1b3a7a0 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -767,7 +767,7 @@ _zoomable_move_resize_cb(void *data, const Efl_Event *ev) r = efl_gfx_geometry_get(ev->object); efl_gfx_size_set(data, r.w, r.h); - efl_gfx_position_set(data, r.x, r.y); + efl_gfx_position_set(data, r.pos); } static void diff --git a/src/bin/elementary/test_scroller.c b/src/bin/elementary/test_scroller.c index 826f06481e..45991c4320 100644 --- a/src/bin/elementary/test_scroller.c +++ b/src/bin/elementary/test_scroller.c @@ -491,8 +491,8 @@ _bounce_cb(void *data) if (!bounce->y1) { elm_interface_scrollable_bounce_allow_set(bounce->scroller, 0, 1); - efl_gfx_position_get(bounce->it1, NULL, &bounce->y1); - efl_gfx_position_get(bounce->it2, NULL, &bounce->y2); + bounce->y1 = efl_gfx_position_get(bounce->it1).y; + bounce->y2 = efl_gfx_position_get(bounce->it2).y; } bounce->state++; diff --git a/src/bin/elementary/test_ui_grid.c b/src/bin/elementary/test_ui_grid.c index b9b7972cab..7ddcdca6c3 100644 --- a/src/bin/elementary/test_ui_grid.c +++ b/src/bin/elementary/test_ui_grid.c @@ -131,15 +131,15 @@ _custom_layout_update(Eo *pack, void *_pd EINA_UNUSED) /* Example custom layout for grid: * divide space into regions of same size, place objects in center of their * cells using their min size - * Note: This is a TERRIBLE layout function (disregards align, weight, ...) + * Note: This is a TERRIBLE layout function (disregards align, weig.ht, ...) */ - int rows, cols, gw, gh, gx, gy, c, r, cs, rs, gmw = 0, gmh = 0; + int rows, cols, c, r, cs, rs, gmw = 0, gmh = 0; Eina_Iterator *it; + Eina_Rect g; Eo *item; - efl_gfx_size_get(pack, &gw, &gh); - efl_gfx_position_get(pack, &gx, &gy); + g = efl_gfx_geometry_get(pack); efl_pack_grid_size_get(pack, &cols, &rows); if (!cols || !rows) goto end; @@ -149,16 +149,15 @@ _custom_layout_update(Eo *pack, void *_pd EINA_UNUSED) { if (efl_pack_grid_position_get(pack, item, &c, &r, &cs, &rs)) { - int x, y, mw, mh; + Eina_Rect m; - efl_gfx_size_hint_combined_min_get(item, &mw, &mh); - x = gx + c * gw / cols + (cs * gw / cols - mw) / 2; - y = gy + r * gh / rows + (rs * gh / rows - mh) / 2; - efl_gfx_size_set(item, mw, mh); - efl_gfx_position_set(item, x, y); + efl_gfx_size_hint_combined_min_get(item, &m.w, &m.h); + m.x = g.x + c * g.w / cols + (cs * g.w / cols - m.w) / 2; + m.y = g.y + r * g.h / rows + (rs * g.h / rows - m.h) / 2; + efl_gfx_geometry_set(item, m); - gmw = MAX(gmw, mw); - gmh = MAX(gmh, mh); + gmw = MAX(gmw, m.w); + gmh = MAX(gmh, m.h); } } eina_iterator_free(it); diff --git a/src/examples/evas/evas-3d-proxy.c b/src/examples/evas/evas-3d-proxy.c index 7a02b81569..74b6d0b362 100644 --- a/src/examples/evas/evas-3d-proxy.c +++ b/src/examples/evas/evas-3d-proxy.c @@ -228,7 +228,7 @@ main(void) #ifdef USE_EO_IMAGE source = efl_add(EFL_CANVAS_IMAGE_CLASS, evas); efl_gfx_buffer_copy_set(source, NULL, IMG_WIDTH, IMG_HEIGHT, 0, EFL_GFX_COLORSPACE_ARGB8888, 0); - efl_gfx_position_set(source, (WIDTH / 2), (HEIGHT / 2)); + efl_gfx_position_set(source, EINA_POSITION2D((WIDTH / 2), (HEIGHT / 2))); efl_gfx_size_set(source, (WIDTH / 2), (HEIGHT / 2)); efl_gfx_visible_set(source, EINA_TRUE); #else diff --git a/src/examples/evas/evas-object-manipulation-eo.c b/src/examples/evas/evas-object-manipulation-eo.c index 40bf266912..3dad0d76e5 100644 --- a/src/examples/evas/evas-object-manipulation-eo.c +++ b/src/examples/evas/evas-object-manipulation-eo.c @@ -176,7 +176,7 @@ main(void) evas_object_name_set(d.bg, "background rectangle"); efl_gfx_color_set(d.bg, 255, 255, 255, 255); /* white bg */ - efl_gfx_position_set(d.bg, 0, 0); + efl_gfx_position_set(d.bg, EINA_POSITION2D(0, 0)); /* at canvas' origin */ efl_gfx_size_set(d.bg, WIDTH, HEIGHT); /* covers full canvas */ @@ -202,7 +202,7 @@ main(void) } else { - efl_gfx_position_set(d.img, 0, 0); + efl_gfx_position_set(d.img, EINA_POSITION2D(0, 0)); efl_gfx_size_set(d.img, WIDTH, HEIGHT); efl_gfx_visible_set(d.img, EINA_TRUE); printf("Image object added, class name is: %s\n", @@ -222,7 +222,7 @@ main(void) { efl_image_border_set(d.clipper_border, 3, 3, 3, 3); efl_image_border_center_fill_set(d.clipper_border, EFL_GFX_BORDER_FILL_MODE_NONE); - efl_gfx_position_set(d.clipper_border, (WIDTH / 4) -3, (HEIGHT / 4) - 3); + efl_gfx_position_set(d.clipper_border, EINA_POSITION2D((WIDTH / 4) -3, (HEIGHT / 4) - 3)); efl_gfx_size_set(d.clipper_border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6); efl_gfx_visible_set(d.clipper_border, EINA_TRUE); } @@ -232,7 +232,7 @@ main(void) * by 255) */ d.clipper = efl_add(EFL_CANVAS_RECTANGLE_CLASS, d.canvas); - efl_gfx_position_set(d.clipper, WIDTH / 4, HEIGHT / 4); + efl_gfx_position_set(d.clipper, EINA_POSITION2D(WIDTH / 4, HEIGHT / 4)); efl_gfx_size_set(d.clipper, WIDTH / 2, HEIGHT / 2); efl_gfx_visible_set(d.clipper, EINA_TRUE); diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 54aca19613..b5020c9cf7 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -5264,15 +5264,15 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta } } else - efl_gfx_position_set(ep->object, ed->x + pf->final.x, ed->y + pf->final.y); + efl_gfx_position_set(ep->object, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y)); #else - efl_gfx_position_set(ep->object, ed->x + pf->final.x, ed->y + pf->final.y); + efl_gfx_position_set(ep->object, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y)); efl_gfx_size_set(ep->object, pf->final.w, pf->final.h); #endif if (ep->nested_smart) /* Move, Resize all nested parts */ { /* Not really needed but will improve the bounding box evaluation done by Evas */ - efl_gfx_position_set(ep->nested_smart, ed->x + pf->final.x, ed->y + pf->final.y); + efl_gfx_position_set(ep->nested_smart, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y)); efl_gfx_size_set(ep->nested_smart, pf->final.w, pf->final.h); } if (ep->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) @@ -5312,7 +5312,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta pd_camera = (Edje_Part_Description_Camera*) ep->chosen_description; - efl_gfx_position_set(ep->object, ed->x + pf->final.x, ed->y + pf->final.y), + efl_gfx_position_set(ep->object, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y)), efl_gfx_size_set(ep->object, pf->final.w, pf->final.h); viewport = evas_object_image_source_get(ep->object); @@ -5563,7 +5563,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (ep->part->type == EDJE_PART_TYPE_GROUP) vis = evas_object_visible_get(ed->obj); - efl_gfx_position_set(ep->typedata.swallow->swallowed_object, ed->x + pf->final.x, ed->y + pf->final.y); + efl_gfx_position_set(ep->typedata.swallow->swallowed_object, EINA_POSITION2D(ed->x + pf->final.x, ed->y + pf->final.y)); efl_gfx_size_set(ep->typedata.swallow->swallowed_object, pf->final.w, pf->final.h); efl_gfx_visible_set(ep->typedata.swallow->swallowed_object, vis); } diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 843bb90f9b..bd25e58101 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -167,18 +167,18 @@ _edje_object_efl_canvas_group_group_del(Eo *obj, Edje *ed) } EOLIAN static void -_edje_object_efl_gfx_position_set(Eo *obj, Edje *ed, Evas_Coord x, Evas_Coord y) +_edje_object_efl_gfx_position_set(Eo *obj, Edje *ed, Eina_Position2D pos) { unsigned short i; - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); - if ((ed->x == x) && (ed->y == y)) return; - ed->x = x; - ed->y = y; + if ((ed->x == pos.x) && (ed->y == pos.y)) return; + ed->x = pos.x; + ed->y = pos.y; // evas_object_move(ed->clipper, ed->x, ed->y); if (_edje_lua_script_only(ed)) diff --git a/src/lib/edje/edje_text.c b/src/lib/edje/edje_text.c index 3c3e1c14c3..bb90d17f79 100644 --- a/src/lib/edje/edje_text.c +++ b/src/lib/edje/edje_text.c @@ -515,7 +515,10 @@ arrange_text: if (!calc_only) { - efl_gfx_position_set(ep->object, ed->x + TO_INT(params->eval.x) + ep->typedata.text->offset.x, ed->y + TO_INT(params->eval.y) + ep->typedata.text->offset.y); + Eina_Position2D pos; + pos.x = ed->x + TO_INT(params->eval.x) + ep->typedata.text->offset.x; + pos.y = ed->y + TO_INT(params->eval.y) + ep->typedata.text->offset.y; + efl_gfx_position_set(ep->object, pos); efl_gfx_visible_set(ep->object, params->visible); } diff --git a/src/lib/efl/interfaces/efl_gfx.eo b/src/lib/efl/interfaces/efl_gfx.eo index eccc2a0aaf..02a92097ab 100644 --- a/src/lib/efl/interfaces/efl_gfx.eo +++ b/src/lib/efl/interfaces/efl_gfx.eo @@ -12,16 +12,17 @@ interface Efl.Gfx { of the window, within its border decorations (application space). ]] set { - [[Moves the given Evas object to the given location inside its - canvas' viewport. + [[Moves the given canvas object to the given location inside its + canvas' viewport. If unchanged this call may be entirely skipped, + but if changed this will trigger move events, as well as + potential pointer,in or pointer,out events. ]] } get { - [[Retrieves the position of the given Evas object.]] + [[Retrieves the position of the given canvas object.]] } values { - x: int; [[X coordinate]] - y: int; [[Y coordinate]] + pos: Eina.Position2D; [[A 2D pixel coordinate.]] } } @property size { diff --git a/src/lib/eina/eina_rectangle.h b/src/lib/eina/eina_rectangle.h index ba3e78f81d..b2792c00c6 100644 --- a/src/lib/eina/eina_rectangle.h +++ b/src/lib/eina/eina_rectangle.h @@ -43,10 +43,13 @@ #define EINA_RECTANGLE_FORMAT "dx%d - %dx%d" #define EINA_RECTANGLE_ARGS(r) (r)->x, (r)->y, (r)->w, (r)->h -#define EINA_RECT(x, y, w, h) ((Eina_Rect) { { x, y, w, h } }) +#define EINA_RECT(x, y, w, h) ((Eina_Rect) { { (x), (y), (w), (h) } }) #define EINA_RECT_ZERO() { EINA_RECTANGLE_INIT } #define EINA_RECT_EMPTY() ((Eina_Rect) EINA_RECT_ZERO()) +#define EINA_POSITION2D(x, y) ((Eina_Position2D) { (x), (y) }) +#define EINA_SIZE2D(x, y) ((Eina_Size2D) { (x), (y) }) + /** @brief A 2D position in pixels coordinates */ typedef struct _Eina_Position2D { diff --git a/src/lib/elementary/efl_ui_grid_static.c b/src/lib/elementary/efl_ui_grid_static.c index dfa128a2ef..fb5601a064 100644 --- a/src/lib/elementary/efl_ui_grid_static.c +++ b/src/lib/elementary/efl_ui_grid_static.c @@ -26,9 +26,9 @@ _efl_ui_grid_static_efl_pack_layout_layout_update(Eo *obj, void *_pd EINA_UNUSED Efl_Ui_Grid_Data *gd; Grid_Item *gi; Evas *e; - Evas_Coord x, y, w, h; long long xl, yl, wl, hl, vwl, vhl; Eina_Bool mirror; + Eina_Rect r; gd = efl_data_scope_get(obj, EFL_UI_GRID_CLASS); if (!gd->items) return; @@ -36,12 +36,11 @@ _efl_ui_grid_static_efl_pack_layout_layout_update(Eo *obj, void *_pd EINA_UNUSED e = evas_object_evas_get(obj); efl_event_freeze(e); - efl_gfx_position_get(obj, &x, &y); - efl_gfx_size_get(obj, &w, &h); - xl = x; - yl = y; - wl = w; - hl = h; + r = efl_gfx_geometry_get(obj); + xl = r.x; + yl = r.y; + wl = r.w; + hl = r.h; mirror = efl_ui_mirrored_get(obj); if (!gd->req_cols || !gd->req_rows) @@ -69,8 +68,7 @@ _efl_ui_grid_static_efl_pack_layout_layout_update(Eo *obj, void *_pd EINA_UNUSED } y1 = yl + ((hl * (long long)gi->row) / vhl); y2 = yl + ((hl * (long long)(gi->row + gi->row_span)) / vhl); - efl_gfx_position_set(gi->object, x1, y1); - efl_gfx_size_set(gi->object, x2 - x1, y2 - y1); + efl_gfx_geometry_set(gi->object, EINA_RECT(x1, y1, x2 - x1, y2 - y1)); } err: efl_event_thaw(e); diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 093e79bff2..b8446653e9 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -615,16 +615,16 @@ _efl_ui_image_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Image_Data *sd) } EOLIAN static void -_efl_ui_image_efl_gfx_position_set(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Coord x, Evas_Coord y) +_efl_ui_image_efl_gfx_position_set(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); - if ((sd->img_x == x) && (sd->img_y == y)) return; - sd->img_x = x; - sd->img_y = y; + if ((sd->img_x == pos.x) && (sd->img_y == pos.y)) return; + sd->img_x = pos.x; + sd->img_y = pos.y; /* takes care of moving */ _efl_ui_image_internal_sizing_eval(obj, sd); diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 0052e6bfd6..e9922db024 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -151,12 +151,12 @@ _calc_job_cb(void *data) } EOLIAN static void -_efl_ui_image_zoomable_pan_efl_gfx_position_set(Eo *obj, Efl_Ui_Image_Zoomable_Pan_Data *psd, Evas_Coord x, Evas_Coord y) +_efl_ui_image_zoomable_pan_efl_gfx_position_set(Eo *obj, Efl_Ui_Image_Zoomable_Pan_Data *psd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), pos); ecore_job_del(psd->wsd->calc_job); psd->wsd->calc_job = ecore_job_add(_calc_job_cb, psd->wobj); @@ -1505,14 +1505,13 @@ _efl_ui_image_zoomable_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Image_Zoomable } EOLIAN static void -_efl_ui_image_zoomable_efl_gfx_position_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Coord x, Evas_Coord y) +_efl_ui_image_zoomable_efl_gfx_position_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } EOLIAN static void diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index a589e591d4..fe4287b57f 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -3263,14 +3263,13 @@ _efl_ui_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Text_Data *sd) } EOLIAN static void -_efl_ui_text_efl_gfx_position_set(Eo *obj, Efl_Ui_Text_Data *sd, Evas_Coord x, Evas_Coord y) +_efl_ui_text_efl_gfx_position_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); if (sd->hoversel) _hoversel_position(obj); diff --git a/src/lib/elementary/efl_ui_textpath.c b/src/lib/elementary/efl_ui_textpath.c index f4ac2a808d..c915ca904f 100644 --- a/src/lib/elementary/efl_ui_textpath.c +++ b/src/lib/elementary/efl_ui_textpath.c @@ -293,6 +293,7 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Bool set_min) const Efl_Gfx_Path_Command_Type *cmd; const double *points; Efl_Ui_Textpath_Segment *seg; + Eina_Position2D opos; EINA_INLIST_FREE(pd->segments, seg) { @@ -300,44 +301,43 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Bool set_min) free(seg); } - Evas_Coord x, y; - efl_gfx_position_get(obj, &x, &y); + opos = efl_gfx_position_get(obj); pd->total_length = 0; efl_gfx_path_get(obj, &cmd, &points); if (cmd) { int pos = -1; - Eina_Rectangle *rect = eina_rectangle_new(0, 0, 0, 0); double px0 = 0.0, py0 = 0.0, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1, px1, py1; + Eina_Rect rect = EINA_RECT_ZERO(); while (*cmd != EFL_GFX_PATH_COMMAND_TYPE_END) { if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO) { pos++; - px0 = points[pos] + x; + px0 = points[pos] + opos.x; pos++; - py0 = points[pos] + y; + py0 = points[pos] + opos.y; } else if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO) { Eina_Bezier bz; double bx, by, bw, bh; - Eina_Rectangle *brect; + Eina_Rect brect; pos++; - ctrl_x0 = points[pos] + x; + ctrl_x0 = points[pos] + opos.x; pos++; - ctrl_y0 = points[pos] + y; + ctrl_y0 = points[pos] + opos.y; pos++; - ctrl_x1 = points[pos] + x; + ctrl_x1 = points[pos] + opos.x; pos++; - ctrl_y1 = points[pos] + y; + ctrl_y1 = points[pos] + opos.y; pos++; - px1 = points[pos] + x; + px1 = points[pos] + opos.x; pos++; - py1 = points[pos] + y; + py1 = points[pos] + opos.y; eina_bezier_values_set(&bz, px0, py0, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1, px1, py1); seg = malloc(sizeof(Efl_Ui_Textpath_Segment)); @@ -359,18 +359,17 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Bool set_min) py0 = py1; eina_bezier_bounds_get(&bz, &bx, &by, &bw, &bh); - brect = eina_rectangle_new(bx, by, bw, bh); - eina_rectangle_union(rect, brect); - eina_rectangle_free(brect); + brect = EINA_RECT(bx, by, bw, bh); + eina_rectangle_union(&rect.rect, &brect.rect); } else if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_LINE_TO) { - Eina_Rectangle *lrect; + Eina_Rect lrect; pos++; - px1 = points[pos] + x; + px1 = points[pos] + opos.x; pos++; - py1 = points[pos] + y; + py1 = points[pos] + opos.y; seg = malloc(sizeof(Efl_Ui_Textpath_Segment)); if (!seg) @@ -389,17 +388,15 @@ _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Bool set_min) pd->segments = eina_inlist_append(pd->segments, EINA_INLIST_GET(seg)); pd->total_length += seg->length; - lrect = eina_rectangle_new(px0, py0, px1 - px0, py1 - py0); - eina_rectangle_union(rect, lrect); - eina_rectangle_free(lrect); + lrect = EINA_RECT(px0, py0, px1 - px0, py1 - py0); + eina_rectangle_union(&rect.rect, &lrect.rect); } cmd++; } if (set_min) { - efl_gfx_size_hint_min_set(obj, rect->w, rect->h); + efl_gfx_size_hint_min_set(obj, rect.w, rect.h); } - eina_rectangle_free(rect); } } @@ -565,9 +562,9 @@ _efl_ui_textpath_elm_widget_theme_apply(Eo *obj, Efl_Ui_Textpath_Data *pd) } EOLIAN static void -_efl_ui_textpath_efl_gfx_position_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Evas_Coord x, Evas_Coord y) +_efl_ui_textpath_efl_gfx_position_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Position2D pos) { - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); _path_data_get(obj, pd, EINA_FALSE); _text_draw(pd); } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 7258c5f7b0..bddf5bf45e 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -927,10 +927,10 @@ _elm_win_resize_job(void *data) if (sd->main_menu) { - int mx, my; + Eina_Position2D pos; - efl_gfx_position_get(sd->main_menu, &mx, &my); - elm_menu_move(sd->main_menu, mx, my); + pos = efl_gfx_position_get(sd->main_menu); + elm_menu_move(sd->main_menu, pos.x, pos.y); } sd->response++; @@ -2922,17 +2922,17 @@ _elm_win_obj_intercept_show(void *data, } EOLIAN static void -_efl_ui_win_efl_gfx_position_set(Eo *obj, Efl_Ui_Win_Data *sd, Evas_Coord x, Evas_Coord y) +_efl_ui_win_efl_gfx_position_set(Eo *obj, Efl_Ui_Win_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; if (sd->img_obj) { - if ((x != sd->screen.x) || (y != sd->screen.y)) + if ((pos.x != sd->screen.x) || (pos.y != sd->screen.y)) { - sd->screen.x = x; - sd->screen.y = y; + sd->screen.x = pos.x; + sd->screen.y = pos.y; efl_event_callback_legacy_call(obj, EFL_GFX_EVENT_MOVE, NULL); } goto super_skip; @@ -2942,19 +2942,19 @@ _efl_ui_win_efl_gfx_position_set(Eo *obj, Efl_Ui_Win_Data *sd, Evas_Coord x, Eva if (!sd->response) { sd->req_xy = EINA_TRUE; - sd->req_x = x; - sd->req_y = y; - TRAP(sd, move, x, y); + sd->req_x = pos.x; + sd->req_y = pos.y; + TRAP(sd, move, pos.x, pos.y); } if (!ecore_evas_override_get(sd->ee)) goto super_skip; } - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); if (ecore_evas_override_get(sd->ee)) { - sd->screen.x = x; - sd->screen.y = y; + sd->screen.x = pos.x; + sd->screen.y = pos.y; efl_event_callback_legacy_call(obj, EFL_GFX_EVENT_MOVE, NULL); } if (sd->frame_obj) @@ -2963,13 +2963,13 @@ _efl_ui_win_efl_gfx_position_set(Eo *obj, Efl_Ui_Win_Data *sd, Evas_Coord x, Eva /* TODO */ /* ecore_wl_window_update_location(sd->wl.win, x, y); */ #endif - sd->screen.x = x; - sd->screen.y = y; + sd->screen.x = pos.x; + sd->screen.y = pos.y; } if (sd->img_obj) { - sd->screen.x = x; - sd->screen.y = y; + sd->screen.x = pos.x; + sd->screen.y = pos.y; } return; @@ -2979,7 +2979,7 @@ super_skip: * Ugly code flow: legacy code had an early return in smart_move, ie. * evas object move would be processed but smart object move would be * aborted. This super call tries to simulate that. */ - efl_gfx_position_set(efl_super(obj, EFL_CANVAS_GROUP_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, EFL_CANVAS_GROUP_CLASS), pos); } EOLIAN static void diff --git a/src/lib/elementary/elm_diskselector.c b/src/lib/elementary/elm_diskselector.c index b5ae1d3f1d..9e69f3caae 100644 --- a/src/lib/elementary/elm_diskselector.c +++ b/src/lib/elementary/elm_diskselector.c @@ -1399,14 +1399,13 @@ _elm_diskselector_efl_canvas_group_group_del(Eo *obj, Elm_Diskselector_Data *sd) } EOLIAN static void -_elm_diskselector_efl_gfx_position_set(Eo *obj, Elm_Diskselector_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_diskselector_efl_gfx_position_set(Eo *obj, Elm_Diskselector_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } EOLIAN static void diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index 02fec566c8..790b3ff4cc 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -3950,14 +3950,13 @@ _elm_entry_efl_canvas_group_group_del(Eo *obj, Elm_Entry_Data *sd) } EOLIAN static void -_elm_entry_efl_gfx_position_set(Eo *obj, Elm_Entry_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_entry_efl_gfx_position_set(Eo *obj, Elm_Entry_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); if (sd->hoversel) _hoversel_position(obj); diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index b700e679b9..710b81e4a9 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -661,12 +661,12 @@ _elm_gengrid_pan_efl_object_destructor(Eo *obj, Elm_Gengrid_Pan_Data *psd) } EOLIAN static void -_elm_gengrid_pan_efl_gfx_position_set(Eo *obj, Elm_Gengrid_Pan_Data *psd, Evas_Coord x, Evas_Coord y) +_elm_gengrid_pan_efl_gfx_position_set(Eo *obj, Elm_Gengrid_Pan_Data *psd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), pos); ecore_job_del(psd->wsd->calc_job); psd->wsd->calc_job = ecore_job_add(_calc_job, psd->wobj); @@ -4225,14 +4225,13 @@ _elm_gengrid_efl_canvas_group_group_del(Eo *obj, Elm_Gengrid_Data *sd) } EOLIAN static void -_elm_gengrid_efl_gfx_position_set(Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_gengrid_efl_gfx_position_set(Eo *obj, Elm_Gengrid_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } EOLIAN static void diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index a8800be549..d66f11d377 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -273,12 +273,12 @@ _elm_genlist_pan_efl_canvas_group_group_del(Eo *obj, Elm_Genlist_Pan_Data *psd) } EOLIAN static void -_elm_genlist_pan_efl_gfx_position_set(Eo *obj, Elm_Genlist_Pan_Data *psd, Evas_Coord x, Evas_Coord y) +_elm_genlist_pan_efl_gfx_position_set(Eo *obj, Elm_Genlist_Pan_Data *psd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), pos); psd->wsd->pan_changed = EINA_TRUE; evas_object_smart_changed(obj); @@ -5705,14 +5705,13 @@ _elm_genlist_efl_canvas_group_group_del(Eo *obj, Elm_Genlist_Data *sd) } EOLIAN static void -_elm_genlist_efl_gfx_position_set(Eo *obj, Elm_Genlist_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_genlist_efl_gfx_position_set(Eo *obj, Elm_Genlist_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } EOLIAN static void diff --git a/src/lib/elementary/elm_hover.c b/src/lib/elementary/elm_hover.c index 0bb2f5ec1f..6b406e053f 100644 --- a/src/lib/elementary/elm_hover.c +++ b/src/lib/elementary/elm_hover.c @@ -328,7 +328,7 @@ _elm_hover_elm_layout_sizing_eval(Eo *obj, Elm_Hover_Data *sd) if (efl_isa(sd->parent, EFL_UI_WIN_CLASS)) { if (efl_canvas_object_is_frame_object_get(obj)) - efl_gfx_position_get(obj, &x, &y); + evas_object_geometry_get(obj, &x, &y, NULL, NULL); else { x = 0; @@ -631,12 +631,12 @@ _elm_hover_efl_canvas_group_group_del(Eo *obj, Elm_Hover_Data *sd) } EOLIAN static void -_elm_hover_efl_gfx_position_set(Eo *obj, Elm_Hover_Data *_pd EINA_UNUSED, Evas_Coord x, Evas_Coord y) +_elm_hover_efl_gfx_position_set(Eo *obj, Elm_Hover_Data *_pd EINA_UNUSED, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); elm_layout_sizing_eval(obj); } diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index e659c1d3e3..223c1fb325 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -102,15 +102,15 @@ _elm_pan_efl_canvas_group_group_del(Eo *obj, Elm_Pan_Smart_Data *_pd EINA_UNUSED } EOLIAN static void -_elm_pan_efl_gfx_position_set(Eo *obj, Elm_Pan_Smart_Data *psd, Evas_Coord x, Evas_Coord y) +_elm_pan_efl_gfx_position_set(Eo *obj, Elm_Pan_Smart_Data *psd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), pos); - psd->x = x; - psd->y = y; + psd->x = pos.x; + psd->y = pos.y; _elm_pan_update(psd); } diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index 2d115a0da7..e740b38dc8 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -2490,14 +2490,13 @@ _elm_list_efl_canvas_group_group_del(Eo *obj, Elm_List_Data *sd) } EOLIAN static void -_elm_list_efl_gfx_position_set(Eo *obj, Elm_List_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_list_efl_gfx_position_set(Eo *obj, Elm_List_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } EOLIAN static void diff --git a/src/lib/elementary/elm_map.c b/src/lib/elementary/elm_map.c index c22f6d90d7..e42a6a0f08 100644 --- a/src/lib/elementary/elm_map.c +++ b/src/lib/elementary/elm_map.c @@ -3932,12 +3932,12 @@ _elm_map_pan_efl_canvas_group_group_calculate(Eo *obj, Elm_Map_Pan_Data *psd) } EOLIAN static void -_elm_map_pan_efl_gfx_position_set(Eo *obj, Elm_Map_Pan_Data *_pd EINA_UNUSED, Evas_Coord x, Evas_Coord y) +_elm_map_pan_efl_gfx_position_set(Eo *obj, Elm_Map_Pan_Data *_pd EINA_UNUSED, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_PAN_CLASS), pos); evas_object_smart_changed(obj); } @@ -4249,14 +4249,13 @@ _elm_map_efl_canvas_group_group_del(Eo *obj, Elm_Map_Data *sd) } EOLIAN static void -_elm_map_efl_gfx_position_set(Eo *obj, Elm_Map_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_map_efl_gfx_position_set(Eo *obj, Elm_Map_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } EOLIAN static void diff --git a/src/lib/elementary/elm_mapbuf.c b/src/lib/elementary/elm_mapbuf.c index 8ae1058e6b..f0212e14d5 100644 --- a/src/lib/elementary/elm_mapbuf.c +++ b/src/lib/elementary/elm_mapbuf.c @@ -156,12 +156,12 @@ _mapbuf_auto_smooth(Evas_Object *obj EINA_UNUSED, Elm_Mapbuf_Data *sd) } EOLIAN static void -_elm_mapbuf_efl_gfx_position_set(Eo *obj, Elm_Mapbuf_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_mapbuf_efl_gfx_position_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); _mapbuf_auto_eval(obj, sd); _mapbuf_auto_smooth(obj, sd); diff --git a/src/lib/elementary/elm_menu.c b/src/lib/elementary/elm_menu.c index c32e7a88cc..d188a04a23 100644 --- a/src/lib/elementary/elm_menu.c +++ b/src/lib/elementary/elm_menu.c @@ -97,17 +97,20 @@ _elm_menu_item_elm_widget_item_signal_emit(Eo *eo_item EINA_UNUSED, Elm_Menu_Ite static inline void _parent_geometry_get(Elm_Menu_Data *sd, int *x, int *y, int *w, int *h) { - evas_object_geometry_get(sd->parent, x, y, w, h); + Eina_Rect r; + + r = efl_gfx_geometry_get(sd->parent); if (efl_isa(sd->parent, EFL_UI_WIN_CLASS)) { if (sd->menu_bar && efl_canvas_object_is_frame_object_get(sd->obj)) - efl_gfx_position_get(sd->obj, x, y); + r.pos = efl_gfx_position_get(sd->obj); else - { - if (x) *x = 0; - if (y) *y = 0; - } + r.pos = EINA_POSITION2D(0, 0); } + if (x) *x = r.x; + if (y) *y = r.y; + if (w) *w = r.w; + if (h) *h = r.h; } static void diff --git a/src/lib/elementary/elm_notify.c b/src/lib/elementary/elm_notify.c index 89f621c8c2..77b5b98f0e 100644 --- a/src/lib/elementary/elm_notify.c +++ b/src/lib/elementary/elm_notify.c @@ -237,27 +237,27 @@ _elm_notify_efl_gfx_size_set(Eo *obj, Elm_Notify_Data *sd, Evas_Coord w, Evas_Co if (!sd->parent && sd->content) { - Evas_Coord x, y; + Eina_Position2D pos; - efl_gfx_position_get(obj, &x, &y); - _notify_move_to_orientation(obj, x, y, w, h); + pos = efl_gfx_position_get(obj); + _notify_move_to_orientation(obj, pos.x, pos.y, w, h); } } EOLIAN static void -_elm_notify_efl_gfx_position_set(Eo *obj, Elm_Notify_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_notify_efl_gfx_position_set(Eo *obj, Elm_Notify_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); if (!sd->parent && sd->content) { Evas_Coord w, h; evas_object_geometry_get(obj, NULL, NULL, &w, &h); - _notify_move_to_orientation(obj, x, y, w, h); + _notify_move_to_orientation(obj, pos.x, pos.y, w, h); } } diff --git a/src/lib/elementary/elm_panel.c b/src/lib/elementary/elm_panel.c index 219315fe39..ba4fa2befa 100644 --- a/src/lib/elementary/elm_panel.c +++ b/src/lib/elementary/elm_panel.c @@ -934,14 +934,13 @@ _elm_panel_efl_canvas_group_group_del(Eo *obj, Elm_Panel_Data *sd) } EOLIAN static void -_elm_panel_efl_gfx_position_set(Eo *obj, Elm_Panel_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_panel_efl_gfx_position_set(Eo *obj, Elm_Panel_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } static void diff --git a/src/lib/elementary/elm_scroller.c b/src/lib/elementary/elm_scroller.c index 95f2694e26..002c467041 100644 --- a/src/lib/elementary/elm_scroller.c +++ b/src/lib/elementary/elm_scroller.c @@ -951,14 +951,13 @@ _elm_scroller_efl_canvas_group_group_add(Eo *obj, Elm_Scroller_Data *priv) } EOLIAN static void -_elm_scroller_efl_gfx_position_set(Eo *obj, Elm_Scroller_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_scroller_efl_gfx_position_set(Eo *obj, Elm_Scroller_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } EOLIAN static void diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index 91f126cff0..e43f788784 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c @@ -2904,14 +2904,13 @@ _elm_toolbar_efl_canvas_group_group_del(Eo *obj, Elm_Toolbar_Data *sd) } EOLIAN static void -_elm_toolbar_efl_gfx_position_set(Eo *obj, Elm_Toolbar_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_toolbar_efl_gfx_position_set(Eo *obj, Elm_Toolbar_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); - - evas_object_move(sd->hit_rect, x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); + efl_gfx_position_set(sd->hit_rect, pos); } EOLIAN static void diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index 4c02e6f831..8ea3085612 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -832,16 +832,16 @@ _smart_reconfigure(Elm_Widget_Smart_Data *sd) } EOLIAN static void -_elm_widget_efl_gfx_position_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Evas_Coord x, Evas_Coord y) +_elm_widget_efl_gfx_position_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - sd->x = x; - sd->y = y; + sd->x = pos.x; + sd->y = pos.y; _smart_reconfigure(sd); - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); } EOLIAN static void diff --git a/src/lib/emotion/emotion_smart.c b/src/lib/emotion/emotion_smart.c index 009e38ffdf..549f82a79e 100644 --- a/src/lib/emotion/emotion_smart.c +++ b/src/lib/emotion/emotion_smart.c @@ -1954,17 +1954,17 @@ _efl_canvas_video_efl_canvas_group_group_del(Evas_Object *obj EINA_UNUSED, Efl_C } EOLIAN static void -_efl_canvas_video_efl_gfx_position_set(Evas_Object *obj, Efl_Canvas_Video_Data *sd, Evas_Coord x, Evas_Coord y) +_efl_canvas_video_efl_gfx_position_set(Evas_Object *obj, Efl_Canvas_Video_Data *sd, Eina_Position2D pos) { int w, h; - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; efl_gfx_size_get(obj, &w, &h); - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); - _clipper_position_size_update(obj, x, y, w, h, sd->video.w, sd->video.h); + _clipper_position_size_update(obj, pos.x, pos.y, w, h, sd->video.w, sd->video.h); } EOLIAN static void diff --git a/src/lib/evas/canvas/efl_canvas_object_event_grabber.c b/src/lib/evas/canvas/efl_canvas_object_event_grabber.c index 35f4b3bec9..590a3f41e4 100644 --- a/src/lib/evas/canvas/efl_canvas_object_event_grabber.c +++ b/src/lib/evas/canvas/efl_canvas_object_event_grabber.c @@ -274,10 +274,10 @@ _efl_canvas_object_event_grabber_efl_canvas_group_group_need_recalculate_get(Eo } EOLIAN static void -_efl_canvas_object_event_grabber_efl_gfx_position_set(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd, int x, int y) +_efl_canvas_object_event_grabber_efl_gfx_position_set(Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd, Eina_Position2D pos) { - efl_gfx_position_set(efl_super(eo_obj, MY_CLASS), x, y); - efl_gfx_position_set(pd->rect, x, y); + efl_gfx_position_set(efl_super(eo_obj, MY_CLASS), pos); + efl_gfx_position_set(pd->rect, pos); } EOLIAN static void diff --git a/src/lib/evas/canvas/evas_object_box.c b/src/lib/evas/canvas/evas_object_box.c index 4673a7cd94..adae4b2a16 100644 --- a/src/lib/evas/canvas/evas_object_box.c +++ b/src/lib/evas/canvas/evas_object_box.c @@ -442,12 +442,12 @@ _evas_box_efl_gfx_size_set(Eo *o, Evas_Object_Box_Data *_pd EINA_UNUSED, Evas_Co } EOLIAN static void -_evas_box_efl_gfx_position_set(Eo *o, Evas_Object_Box_Data *_pd EINA_UNUSED, Evas_Coord x, Evas_Coord y) +_evas_box_efl_gfx_position_set(Eo *o, Evas_Object_Box_Data *_pd EINA_UNUSED, Eina_Position2D pos) { - if (_evas_object_intercept_call(o, EVAS_OBJECT_INTERCEPT_CB_MOVE , 0, x, y)) + if (_evas_object_intercept_call(o, EVAS_OBJECT_INTERCEPT_CB_MOVE , 0, pos)) return; - efl_gfx_position_set(efl_super(o, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(o, MY_CLASS), pos); evas_object_smart_changed(o); } diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 4fc7a13d55..f21fea1e17 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1158,7 +1158,7 @@ end: EOLIAN static void _efl_canvas_object_efl_gfx_geometry_set(Eo *obj, Evas_Object_Protected_Data *pd EINA_UNUSED, Eina_Rect r) { - efl_gfx_position_set(obj, r.x, r.y); + efl_gfx_position_set(obj, r.pos); efl_gfx_size_set(obj, r.w, r.h); } @@ -1174,17 +1174,18 @@ evas_object_geometry_set(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y, Evas_C EAPI void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) { - efl_gfx_position_set((Evas_Object *)obj, x, y); + efl_gfx_position_set(obj, EINA_POSITION2D(x, y)); } EOLIAN static void -_efl_canvas_object_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, - Evas_Coord x, Evas_Coord y) +_efl_canvas_object_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Position2D pos) { Eina_Bool pass = EINA_FALSE, freeze = EINA_FALSE; Eina_Bool source_invisible = EINA_FALSE; Eina_List *was = NULL; Evas_Map *map; + int x = pos.x; + int y = pos.y; if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 1, x, y)) return; @@ -1332,20 +1333,14 @@ evas_object_geometry_get(const Evas_Object *eo_obj, Evas_Coord *x, Evas_Coord *y if (h) *h = r.h; } -EOLIAN static void +EOLIAN static Eina_Position2D _efl_canvas_object_efl_gfx_position_get(Eo *obj EINA_UNUSED, - Evas_Object_Protected_Data *pd, - Evas_Coord *x, Evas_Coord *y) + Evas_Object_Protected_Data *pd) { if ((pd->delete_me) || (!pd->layer)) - { - if (x) *x = 0; - if (y) *y = 0; - return; - } + return EINA_POSITION2D(0, 0); - if (x) *x = pd->cur->geometry.x; - if (y) *y = pd->cur->geometry.y; + return ((Eina_Rect) pd->cur->geometry).pos; } EOLIAN static void @@ -2060,11 +2055,10 @@ _efl_canvas_object_efl_object_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Dat double scale; unsigned int m; int r, g, b, a; - int w, h; //int requestw, requesth; int minw, minh; int maxw, maxh; - int x, y; + Eina_Rect geom; short layer; Eina_Bool focus; Eina_Bool visible; @@ -2076,8 +2070,7 @@ _efl_canvas_object_efl_object_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Dat visible = efl_gfx_visible_get(eo_obj); layer = efl_gfx_stack_layer_get(eo_obj); name = efl_name_get(eo_obj); // evas_object_name_get(eo_obj); - efl_gfx_position_get(eo_obj, &x, &y); - efl_gfx_size_get(eo_obj, &w, &h); + geom = efl_gfx_geometry_get(eo_obj); scale = efl_canvas_object_scale_get(eo_obj); efl_gfx_size_hint_restricted_min_get(eo_obj, &minw, &minh); efl_gfx_size_hint_max_get(eo_obj, &maxw, &maxh); @@ -2100,12 +2093,12 @@ _efl_canvas_object_efl_object_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Dat EFL_DBG_INFO_APPEND(group, "Layer", EINA_VALUE_TYPE_INT, layer); node = EFL_DBG_INFO_LIST_APPEND(group, "Position"); - EFL_DBG_INFO_APPEND(node, "x", EINA_VALUE_TYPE_INT, x); - EFL_DBG_INFO_APPEND(node, "y", EINA_VALUE_TYPE_INT, y); + EFL_DBG_INFO_APPEND(node, "x", EINA_VALUE_TYPE_INT, geom.x); + EFL_DBG_INFO_APPEND(node, "y", EINA_VALUE_TYPE_INT, geom.y); node = EFL_DBG_INFO_LIST_APPEND(group, "Size"); - EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, w); - EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, h); + EFL_DBG_INFO_APPEND(node, "w", EINA_VALUE_TYPE_INT, geom.w); + EFL_DBG_INFO_APPEND(node, "h", EINA_VALUE_TYPE_INT, geom.h); EFL_DBG_INFO_APPEND(group, "Scale", EINA_VALUE_TYPE_DOUBLE, scale); diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c index 31004ba5f5..411bbef408 100644 --- a/src/lib/evas/canvas/evas_object_smart.c +++ b/src/lib/evas/canvas/evas_object_smart.c @@ -886,14 +886,14 @@ _efl_canvas_group_efl_gfx_visible_set(Eo *eo_obj, Evas_Smart_Data *o, Eina_Bool } EOLIAN static void -_efl_canvas_group_efl_gfx_position_set(Eo *eo_obj, Evas_Smart_Data *o, Evas_Coord x, Evas_Coord y) +_efl_canvas_group_efl_gfx_position_set(Eo *eo_obj, Evas_Smart_Data *o, Eina_Position2D pos) { - if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; if (o->clipped) - _evas_object_smart_clipped_smart_move_internal(eo_obj, x, y); - efl_gfx_position_set(efl_super(eo_obj, MY_CLASS), x, y); + _evas_object_smart_clipped_smart_move_internal(eo_obj, pos.x, pos.y); + efl_gfx_position_set(efl_super(eo_obj, MY_CLASS), pos); } EOLIAN static void diff --git a/src/lib/evas/canvas/evas_object_table.c b/src/lib/evas/canvas/evas_object_table.c index cfbb8bc79e..bd4c2cc668 100644 --- a/src/lib/evas/canvas/evas_object_table.c +++ b/src/lib/evas/canvas/evas_object_table.c @@ -944,12 +944,12 @@ _evas_table_efl_gfx_size_set(Eo *obj, Evas_Table_Data *_pd EINA_UNUSED, Evas_Coo } EOLIAN static void -_evas_table_efl_gfx_position_set(Eo *obj, Evas_Table_Data *_pd EINA_UNUSED, Evas_Coord x, Evas_Coord y) +_evas_table_efl_gfx_position_set(Eo *obj, Evas_Table_Data *_pd EINA_UNUSED, Eina_Position2D pos) { - if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y)) + if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y)) return; - efl_gfx_position_set(efl_super(obj, MY_CLASS), x, y); + efl_gfx_position_set(efl_super(obj, MY_CLASS), pos); evas_object_smart_changed(obj); } diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 11937fab0c..20b0a7913a 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -7922,18 +7922,16 @@ evas_textblock_text_utf8_to_markup(const Evas_Object *eo_obj, const char *text) static void _obstacle_update(Evas_Textblock_Obstacle *obs, Eo *eo_obj) { - Evas_Coord x, y; - Evas_Coord ox, oy, ow, oh; + Eina_Rect tb_geom, obs_geom; Eo *eo_obs = obs->eo_obs; - efl_gfx_position_get(eo_obs, &ox, &oy); - efl_gfx_size_get(eo_obs, &ow, &oh); - efl_gfx_position_get(eo_obj, &x, &y); + obs_geom = efl_gfx_geometry_get(eo_obs); + tb_geom = efl_gfx_geometry_get(eo_obj); - obs->x = ox - x; - obs->y = oy - y; - obs->w = ow; - obs->h = oh; + obs->x = obs_geom.x - tb_geom.x; + obs->y = obs_geom.y - tb_geom.y; + obs->w = obs_geom.w; + obs->h = obs_geom.h; } static void diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c index dd32a50aca..f983f8d8ca 100644 --- a/src/lib/evas/canvas/evas_vg_node.c +++ b/src/lib/evas/canvas/evas_vg_node.c @@ -86,23 +86,19 @@ _efl_vg_origin_get(Eo *obj EINA_UNUSED, } static void -_efl_vg_efl_gfx_position_set(Eo *obj EINA_UNUSED, - Efl_VG_Data *pd, - int x, int y) +_efl_vg_efl_gfx_position_set(Eo *obj EINA_UNUSED, Efl_VG_Data *pd, Eina_Position2D pos) { - pd->x = lrint(x); - pd->y = lrint(y); + pd->x = (double) pos.x; + pd->y = (double) pos.y; _efl_vg_changed(obj); } -static void -_efl_vg_efl_gfx_position_get(Eo *obj EINA_UNUSED, - Efl_VG_Data *pd, - int *x, int *y) +static Eina_Position2D +_efl_vg_efl_gfx_position_get(Eo *obj EINA_UNUSED, Efl_VG_Data *pd) { - if (x) *x = pd->x; - if (y) *y = pd->y; + // NOTE: This casts double to int! + return EINA_POSITION2D(pd->x, pd->y); } static void @@ -205,7 +201,7 @@ EOLIAN static Eina_Rect _efl_vg_efl_gfx_geometry_get(Eo *obj, Efl_VG_Data *pd EINA_UNUSED) { Eina_Rect r = EINA_RECT_ZERO(); - efl_gfx_position_get(obj, &r.x, &r.y); + r.pos = efl_gfx_position_get(obj); efl_gfx_size_get(obj, &r.w, &r.h); return r; } @@ -810,14 +806,17 @@ evas_vg_node_color_set(Eo *obj, int r, int g, int b, int a) EAPI void evas_vg_node_geometry_get(Eo *obj, int *x, int *y, int *w, int *h) { - efl_gfx_position_get(obj, x, y); + Eina_Rect r; + r.pos = efl_gfx_position_get(obj); efl_gfx_size_get(obj, w, h); + if (x) *x = r.x; + if (y) *y = r.y; } EAPI void evas_vg_node_geometry_set(Eo *obj, int x, int y, int w, int h) { - efl_gfx_position_set(obj, x, y); + efl_gfx_position_set(obj, EINA_POSITION2D(x, y)); efl_gfx_size_set(obj, w, h); } diff --git a/src/tests/emotion/emotion_test_main-eo.c b/src/tests/emotion/emotion_test_main-eo.c index 0f33f5a7af..9663ab719e 100644 --- a/src/tests/emotion/emotion_test_main-eo.c +++ b/src/tests/emotion/emotion_test_main-eo.c @@ -113,7 +113,7 @@ bg_setup(void) { o_bg = efl_add(EDJE_OBJECT_CLASS, evas); efl_file_set(o_bg, theme_file, "background"); - efl_gfx_position_set(o_bg, 0, 0); + efl_gfx_position_set(o_bg, EINA_POSITION2D(0, 0)); efl_gfx_size_set(o_bg, startw, starth); efl_gfx_stack_layer_set(o_bg, -999); efl_gfx_visible_set(o_bg, EINA_TRUE); @@ -553,11 +553,14 @@ video_obj_signal_frame_move_cb(void *data EINA_UNUSED, Evas_Object *o, const cha if (!fd) return; if (fd->moving) { - Evas_Coord x, y, ox, oy; + Evas_Coord x, y; + Eina_Position2D pos; evas_canvas_pointer_canvas_xy_get(evas_object_evas_get(o), &x, &y); - efl_gfx_position_get(o, &ox, &oy); - efl_gfx_position_set(o, ox + (x - fd->x), oy + (y - fd->y)); + pos = efl_gfx_position_get(o); + pos.x += (x - fd->x); + pos.y += (y - fd->y); + efl_gfx_position_set(o, pos); fd->x = x; fd->y = y; } @@ -624,7 +627,7 @@ init_video_object(const char *module_filename, const char *filename) edje_object_part_swallow(oe, "video_swallow", o); offset = 20 * (eina_list_count(video_objs) - 1); - efl_gfx_position_set(oe, offset, offset); + efl_gfx_position_set(oe, EINA_POSITION2D(offset, offset)); edje_object_size_min_calc(oe, &w, &h); efl_gfx_size_set(oe, w, h);