Enlightenment CVS committal
Author : atmosphere
Project : e17
Module : proto
Dir : e17/proto/esmart/src/draggies
Modified Files:
dragable.c dragable.h
Log Message:
this works right finally :)
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/esmart/src/draggies/dragable.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- dragable.c 13 Jan 2004 18:04:15 -0000 1.2
+++ dragable.c 20 Jan 2004 13:40:46 -0000 1.3
@@ -22,7 +22,10 @@
if ((e = (Evas_Event_Mouse_Up *) ev))
{
if (e->button == drag->button)
- drag->clicked = 0;
+ {
+ drag->clicked = 0;
+ drag->dx = drag->dy = 0;
+ }
}
}
}
@@ -31,15 +34,23 @@
{
Esmart_Draggies *drag = NULL;
Evas_Event_Mouse_Down *e = NULL;
+ Ecore_X_Event_Mouse_Button_Down *evx = NULL;
+
if ((drag = (Esmart_Draggies *) data))
{
- if ((e = (Evas_Event_Mouse_Down *) ev))
+ if (ecore_event_current_type_get () == ECORE_X_EVENT_MOUSE_BUTTON_DOWN)
{
- if (e->button == drag->button)
+ if ((evx = ecore_event_current_event_get ()))
{
- drag->first = drag->clicked = 1;
- drag->cx = e->canvas.x;
- drag->cy = e->canvas.y;
+ if ((e = (Evas_Event_Mouse_Down *) ev))
+ {
+ if (e->button == drag->button)
+ {
+ drag->clicked = 1;
+ drag->dx = evx->x;
+ drag->dy = evx->y;
+ }
+ }
}
}
}
@@ -47,35 +58,22 @@
static void
_mouse_move_cb (void *data, Evas * evas, Evas_Object * obj, void *ev)
{
- int x, y, w, h;
Esmart_Draggies *drag = NULL;
- Evas_Event_Mouse_Move *e = NULL;
+ Ecore_X_Event_Mouse_Move *evx = NULL;
if ((drag = (Esmart_Draggies *) data))
{
- if ((e = (Evas_Event_Mouse_Move *) ev))
+ if (ecore_event_current_type_get () == ECORE_X_EVENT_MOUSE_MOVE)
{
- if (drag->clicked)
+ if ((evx = ecore_event_current_event_get ()))
{
- double dx, dy;
-
- ecore_evas_geometry_get (drag->ee, &x, &y, &w, &h);
- dx = (drag->cx - e->cur.canvas.x);
- dy = (drag->cy - e->cur.canvas.y);
- if ((dx < 1) && (dy < 1))
- return;
-
- ecore_evas_move (drag->ee, x - (int) dx, y - (int) dy);
- if (!drag->first)
+ if (drag->clicked)
{
- drag->cx = e->cur.canvas.x + dx;
- drag->cy = e->cur.canvas.y + dy;
- }
- else
- {
- drag->cx = e->cur.canvas.x;
- drag->cy = e->cur.canvas.y;
- drag->first = 0;
+ int dx, dy;
+
+ dx = evx->root.x - drag->dx;
+ dy = evx->root.y - drag->dy;
+ ecore_evas_move (drag->ee, dx, dy);
}
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/esmart/src/draggies/dragable.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- dragable.h 13 Jan 2004 18:04:15 -0000 1.2
+++ dragable.h 20 Jan 2004 13:40:46 -0000 1.3
@@ -14,9 +14,8 @@
struct _Esmart_Draggies
{
Ecore_Evas *ee; /* The ecore_evas that should move */
- Evas_Coord cx, cy, cw, ch; /* current mouse x/y ecore_evas h/w */
+ int dx, dy; /* offset from 0,0 of the window */
int clicked; /* Whether the mouse is down now or not */
- int first; /* Whether it's the first move or not */
int button; /* the button that handles dragging */
};
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs