Hello, As I remember we not use 'printf' for print logging. Best regards Vyacheslav Reutskiy
On Fri, Sep 18, 2015 at 11:37 AM, Thiep Ha <thiep...@gmail.com> wrote: > jackdanielz pushed a commit to branch master. > > > http://git.enlightenment.org/core/elementary.git/commit/?id=0363553dfced5eb0a8000c3493bf2fb53407f589 > > commit 0363553dfced5eb0a8000c3493bf2fb53407f589 > Author: Thiep Ha <thiep...@gmail.com> > Date: Fri Sep 18 11:30:23 2015 +0300 > > dnd/x11: correct coordinates in pos callback > > Summary: > The x, y coordinates in pos callback should be relative to > the top-left of the object. > This patch corrects the x,y coordinates and adds poscb to elementary > test > to clearly show the bug case. > > Test: > Run Genlist Dnd Dflt Anim with the change in this patch. > Drag an item to other genlist and see the printed out item, x, y. > > @fix > > Reviewers: JackDanielZ > > Subscribers: seoz > > Differential Revision: https://phab.enlightenment.org/D3063 > --- > src/bin/test_dnd.c | 30 ++++++++++++++++++++++++++---- > src/lib/elm_cnp.c | 11 +++++++++-- > 2 files changed, 35 insertions(+), 6 deletions(-) > > diff --git a/src/bin/test_dnd.c b/src/bin/test_dnd.c > index 4b6124a..dd24585 100644 > --- a/src/bin/test_dnd.c > +++ b/src/bin/test_dnd.c > @@ -217,6 +217,14 @@ _strndup(const char *str, size_t len) > return ret; > } > > +static void > +_gl_poscb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, > Evas_Coord x, Evas_Coord y, int xposret, int yposret, Elm_Xdnd_Action > action EINA_UNUSED) > +{ > + printf("<%s> <%d> obj: %p, item: %p <%s>, x y: %d %d, posret: %d %d\n", > + __func__, __LINE__, obj, it, elm_object_item_text_get(it), > + x, y, xposret, yposret); +} > + > static Eina_Bool > _gl_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, > Elm_Selection_Data *ev, int xposret EINA_UNUSED, int yposret) > { /* This function is called when data is dropped on the genlist */ > @@ -761,18 +769,32 @@ void > test_dnd_genlist_default_anim(void *data EINA_UNUSED, Evas_Object *obj > EINA_UNUSED, void *event_info EINA_UNUSED) > { > char buf[PATH_MAX]; > - Evas_Object *win, *gl, *bxx; > + Evas_Object *win, *gl, *bxx, *bx2, *lb; > int i, j; > > win = elm_win_util_standard_add("dnd-genlist-default-anim", > "DnD-Genlist-Default-Anim"); > elm_win_autodel_set(win, EINA_TRUE); > > bxx = elm_box_add(win); > - elm_box_horizontal_set(bxx, EINA_TRUE); > + elm_box_horizontal_set(bxx, EINA_FALSE); > evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, > EVAS_HINT_EXPAND); > elm_win_resize_object_add(win, bxx); > evas_object_show(bxx); > > + lb = elm_label_add(win); > + elm_object_text_set(lb, "Drag and drop between genlists with default > anim."); > + evas_object_size_hint_min_set(lb, 0, 50); > + evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5); > + evas_object_show(lb); > + elm_box_pack_end(bxx, lb); > + > + bx2 = elm_box_add(win); > + elm_box_horizontal_set(bx2, EINA_TRUE); > + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); > + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, > EVAS_HINT_EXPAND); > + evas_object_show(bx2); > + elm_box_pack_end(bxx, bx2); > + > itc1 = elm_genlist_item_class_new(); > itc1->item_style = "default"; > itc1->func.text_get = gl_text_get; > @@ -791,7 +813,7 @@ test_dnd_genlist_default_anim(void *data EINA_UNUSED, > Evas_Object *obj EINA_UNUS > _gl_item_getcb, > NULL, NULL, > NULL, NULL, > - NULL, NULL, > + _gl_poscb, NULL, > _gl_dropcb, NULL); > > elm_drag_item_container_add(gl, ANIM_TIME, DRAG_TIMEOUT, > @@ -802,7 +824,7 @@ test_dnd_genlist_default_anim(void *data EINA_UNUSED, > Evas_Object *obj EINA_UNUS > //elm_genlist_mode_set(gl, ELM_LIST_LIMIT); > evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, > EVAS_HINT_EXPAND); > evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, > EVAS_HINT_FILL); > - elm_box_pack_end(bxx, gl); > + elm_box_pack_end(bx2, gl); > evas_object_show(gl); > > for (i = 0; i < 20; i++) > diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c > index d9e6c51..00d5aa5 100644 > --- a/src/lib/elm_cnp.c > +++ b/src/lib/elm_cnp.c > @@ -1331,10 +1331,13 @@ _x11_dnd_dropable_handle(Dropable *dropable, > Evas_Coord x, Evas_Coord y, Elm_Xdn > { > if (last_dropable == dropable) // same > { > + Evas_Coord ox, oy; > + > cnp_debug("same obj dropable %p\n", dropable->obj); > + evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, > NULL); > EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs) > if ((cbs->types & dropable->last.format) && cbs->poscb) > - cbs->poscb(cbs->posdata, dropable->obj, x, y, action); > + cbs->poscb(cbs->posdata, dropable->obj, x - ox, y - oy, > action); > } > else > { > @@ -1367,7 +1370,10 @@ _x11_dnd_dropable_handle(Dropable *dropable, > Evas_Coord x, Evas_Coord y, Elm_Xdn > { > if (dropable) // enter new obj > { > + Evas_Coord ox, oy; > + > cnp_debug("enter %p\n", dropable->obj); > + evas_object_geometry_get(dropable->obj, &ox, &oy, NULL, > NULL); > dropable->last.in = EINA_TRUE; > EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs) > { > @@ -1376,7 +1382,8 @@ _x11_dnd_dropable_handle(Dropable *dropable, > Evas_Coord x, Evas_Coord y, Elm_Xdn > if (cbs->entercb) > cbs->entercb(cbs->enterdata, dropable->obj); > if (cbs->poscb) > - cbs->poscb(cbs->posdata, dropable->obj, x, y, > action); > + cbs->poscb(cbs->posdata, dropable->obj, > + x - ox, y - oy, action); > } > } > } > > -- > > > ------------------------------------------------------------------------------ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel