Enlightenment CVS committal
Author : sebastid
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_border.c e_dnd.c e_dnd.h
Log Message:
The icon is now correctly positioned relative to the mouse.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -3 -r1.202 -r1.203
--- e_border.c 14 May 2005 05:35:46 -0000 1.202
+++ e_border.c 15 May 2005 05:20:17 -0000 1.203
@@ -2512,38 +2512,38 @@
{
if ((bd->drag.x == -1) && (bd->drag.y == -1))
{
- bd->drag.x = ev->x;
- bd->drag.y = ev->y;
+ bd->drag.x = ev->root.x;
+ bd->drag.y = ev->root.y;
}
else
{
int x, y;
double dist;
- x = bd->drag.x - ev->x;
- y = bd->drag.y - ev->y;
+ x = bd->drag.x - ev->root.x;
+ y = bd->drag.y - ev->root.y;
dist = sqrt(pow(x, 2) + pow(y, 2));
- if (dist > 10)
+ if (dist > 4)
{
/* start drag! */
if (bd->icon_object)
{
E_Drag *drag;
Evas_Object *o;
- Evas_Coord w, h;
+ Evas_Coord x, y, w, h;
const char *file, *part;
- drag = e_drag_new(bd->zone->container,
+ evas_object_geometry_get(bd->icon_object,
+ &x, &y, &w, &h);
+ drag = e_drag_new(bd->zone->container, bd->x + x,
bd->y + y,
"enlightenment/border", bd, NULL);
o = edje_object_add(drag->evas);
edje_object_file_get(bd->icon_object, &file, &part);
edje_object_file_set(o, file, part);
e_drag_object_set(drag, o);
- evas_object_geometry_get(bd->icon_object,
- NULL, NULL, &w, &h);
e_drag_resize(drag, w, h);
- e_drag_start(drag);
+ e_drag_start(drag, bd->drag.x, bd->drag.y);
evas_event_feed_mouse_up(bd->bg_evas, 1,
EVAS_BUTTON_NONE, NULL);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- e_dnd.c 11 May 2005 21:33:52 -0000 1.23
+++ e_dnd.c 15 May 2005 05:20:17 -0000 1.24
@@ -119,7 +119,7 @@
}
E_Drag*
-e_drag_new(E_Container *container,
+e_drag_new(E_Container *container, int x, int y,
const char *type, void *data,
void (*finished_cb)(E_Drag *drag, int dropped))
{
@@ -128,8 +128,8 @@
drag = E_OBJECT_ALLOC(E_Drag, E_DRAG_TYPE, _e_drag_free);
if (!drag) return NULL;
- drag->x = 0;
- drag->y = 0;
+ drag->x = x;
+ drag->y = y;
drag->w = 24;
drag->h = 24;
drag->layer = 250;
@@ -221,15 +221,15 @@
void
e_drag_move(E_Drag *drag, int x, int y)
{
- if ((drag->x == x) && (drag->y == y)) return;
- drag->x = x;
- drag->y = y;
+ if (((drag->x + drag->dx) == x) && ((drag->y + drag->dy) == y)) return;
+ drag->x = x - drag->dx;
+ drag->y = y - drag->dy;
ecore_evas_move(drag->ecore_evas,
- drag->x - (drag->w / 2),
- drag->y - (drag->h / 2));
+ drag->x,
+ drag->y);
e_container_shape_move(drag->shape,
- drag->x - (drag->w / 2),
- drag->y - (drag->h / 2));
+ drag->x,
+ drag->y);
}
void
@@ -250,7 +250,7 @@
}
void
-e_drag_start(E_Drag *drag)
+e_drag_start(E_Drag *drag, int x, int y)
{
Evas_List *l;
@@ -261,6 +261,9 @@
ecore_x_pointer_confine_grab(_drag_win);
ecore_x_keyboard_grab(_drag_win);
+ drag->dx = x - drag->x;
+ drag->dy = y - drag->y;
+
for (l = _drop_handlers; l; l = l->next)
{
E_Drop_Handler *h;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- e_dnd.h 11 May 2005 21:33:53 -0000 1.17
+++ e_dnd.h 15 May 2005 05:20:17 -0000 1.18
@@ -34,6 +34,7 @@
Evas_Object *object;
int x, y, w, h;
+ int dx, dy;
unsigned int layer;
unsigned char visible : 1;
@@ -81,7 +82,8 @@
EAPI int e_dnd_active(void);
-EAPI E_Drag* e_drag_new(E_Container *container, const char *type, void *data,
+/* x and y are the top left coords of the object that is to be dragged */
+EAPI E_Drag* e_drag_new(E_Container *container, int x, int y, const char
*type, void *data,
void (*finished_cb)(E_Drag *drag, int dropped));
EAPI Evas *e_drag_evas_get(E_Drag *drag);
EAPI void e_drag_object_set(E_Drag *drag, Evas_Object *object);
@@ -91,7 +93,8 @@
EAPI void e_drag_resize(E_Drag *drag, int w, int h);
EAPI void e_drag_idler_before(void);
-EAPI void e_drag_start(E_Drag *drag);
+/* x and y are the coords where the mouse is when dragging starts */
+EAPI void e_drag_start(E_Drag *drag, int x, int y);
EAPI void e_drag_update(int x, int y);
EAPI void e_drag_end(int x, int y);
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs