From 32a8f5160d8cb90d99ec3de4d57794bcd0f8827f Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Tue, 9 Nov 2010 21:14:38 +0000 Subject: [PATCH] Fix dnd working with reference coords. SVN revision: 54383 --- src/bin/e_gadcon.c | 15 --------------- src/bin/e_gadcon.h | 1 - src/modules/ibar/e_mod_main.c | 9 +++------ src/modules/ibox/e_mod_main.c | 8 +++----- src/modules/pager/e_mod_main.c | 18 ++++-------------- 5 files changed, 10 insertions(+), 41 deletions(-) diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index 080b9ff89..04ae129e2 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -1266,21 +1266,6 @@ e_gadcon_client_viewport_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int return 1; } -/* - * position x, y is in viewport coords, return is in object coords - */ -EAPI int -e_gadcon_client_object_position_get(E_Gadcon_Client *gcc, int x, int y, int *rx, int *ry) -{ - int xx = 0, yy = 0; - - if (gcc->o_box) evas_object_geometry_get(gcc->o_box, &xx, &yy, NULL, NULL); - else if (gcc->o_base) evas_object_geometry_get(gcc->o_base, &xx, &yy, NULL, NULL); - if (rx) *rx = x + xx; - if (ry) *ry = y + yy; - return 1; -} - EAPI E_Zone * e_gadcon_client_zone_get(E_Gadcon_Client *gcc) { diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h index 7490a4238..9ba6e626f 100644 --- a/src/bin/e_gadcon.h +++ b/src/bin/e_gadcon.h @@ -286,7 +286,6 @@ EAPI void e_gadcon_client_autoscroll_cb_set(E_Gadcon_Client *gcc, vo EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable); EAPI int e_gadcon_client_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *h); EAPI int e_gadcon_client_viewport_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *h); -EAPI int e_gadcon_client_object_position_get(E_Gadcon_Client *gcc, int x, int y, int *rx, int *ry); EAPI E_Zone *e_gadcon_client_zone_get(E_Gadcon_Client *gcc); EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu_main, E_Menu *menu_gadget, int flags); EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc); diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index 547baa0f2..c1b15a85f 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -988,16 +988,13 @@ _ibar_inst_cb_scroll(void *data) static void _ibar_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y) { - Evas_Coord xx, yy; - Evas_Coord ox, oy; IBar_Icon *ic; inst->ibar->dnd_x = x; inst->ibar->dnd_y = y; if (inst->ibar->o_drop) e_box_unpack(inst->ibar->o_drop); - e_gadcon_client_object_position_get(inst->gcc, x, y, &xx, &yy); - ic = _ibar_icon_at_coord(inst->ibar, xx, yy); + ic = _ibar_icon_at_coord(inst->ibar, x, y); /* This handles autoscrolling bars that would otherwise prevent us * from dropping in the very last spot in the ibar. This is not @@ -1027,11 +1024,11 @@ _ibar_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y) evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); if (e_box_orientation_get(inst->ibar->o_box)) { - if ((x + xx) < (ix + (iw / 2))) before = 1; + if (x < (ix + (iw / 2))) before = 1; } else { - if ((y + yy) < (iy + (ih / 2))) before = 1; + if (y < (iy + (ih / 2))) before = 1; } if (before) e_box_pack_before(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder); diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c index 4a3668b21..e54974d59 100644 --- a/src/modules/ibox/e_mod_main.c +++ b/src/modules/ibox/e_mod_main.c @@ -841,7 +841,6 @@ _ibox_inst_cb_scroll(void *data) static void _ibox_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y) { - Evas_Coord xx, yy; IBox_Icon *ic; inst->ibox->dnd_x = x; @@ -849,8 +848,7 @@ _ibox_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y) if (inst->ibox->o_drop) e_box_unpack(inst->ibox->o_drop); - e_gadcon_client_object_position_get(inst->gcc, x, y, &xx, &yy); - ic = _ibox_icon_at_coord(inst->ibox, xx, yy); + ic = _ibox_icon_at_coord(inst->ibox, x, y); inst->ibox->ic_drop_before = ic; if (ic) { @@ -860,11 +858,11 @@ _ibox_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y) evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); if (e_box_orientation_get(inst->ibox->o_box)) { - if ((x + xx) < (ix + (iw / 2))) before = 1; + if (x < (ix + (iw / 2))) before = 1; } else { - if ((y + yy) < (iy + (ih / 2))) before = 1; + if (y < (iy + (ih / 2))) before = 1; } if (before) e_box_pack_before(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder); diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index 9d16afb40..4ab85bdf0 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -1932,17 +1932,11 @@ static void _pager_update_drop_position(Pager *p, Evas_Coord x, Evas_Coord y) { Pager_Desk *pd, *pd2; - Evas_Coord xx, yy; - int ox, oy; Eina_List *l; - ox = oy = 0; - p->dnd_x = x; p->dnd_y = y; - evas_object_geometry_get(p->o_table, &xx, &yy, NULL, NULL); - if (p->inst) e_box_align_pixel_offset_get(p->inst->gcc->o_box, &ox, &oy); - pd = _pager_desk_at_coord(p, x + xx + ox, y + yy + oy); + pd = _pager_desk_at_coord(p, x, y); if (pd == p->active_drop_pd) return; for (l = p->desks; l; l = l->next) { @@ -2032,8 +2026,6 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info) Eina_List *l; int dx = 0, dy = 0; Pager_Win *pw = NULL; - Evas_Coord xx, yy; - int x = 0, y = 0; Evas_Coord wx, wy, wx2, wy2; Evas_Coord nx, ny; Pager *p; @@ -2043,9 +2035,7 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info) if (act_popup) p = act_popup->pager; - evas_object_geometry_get(p->o_table, &xx, &yy, NULL, NULL); - if (p->inst) e_box_align_pixel_offset_get(p->inst->gcc->o_box, &x, &y); - pd = _pager_desk_at_coord(p, ev->x + xx + x, ev->y + yy + y); + pd = _pager_desk_at_coord(p, ev->x, ev->y); if (pd) { if (!strcmp(type, "enlightenment/pager_win")) @@ -2086,8 +2076,8 @@ _pager_drop_cb_drop(void *data, const char *type, void *event_info) int zx, zy; e_layout_coord_canvas_to_virtual(pd->o_layout, - ev->x + xx + x + dx, - ev->y + yy + y + dy, + ev->x + dx, + ev->y + dy, &nx, &ny); e_zone_useful_geometry_get(pd->desk->zone, &zx, &zy, NULL, NULL);