Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_dnd.h e_dnd.c e_border.c 


Log Message:
Possible with more types for a drag. Doesn't make sense for internal dnd,
since we don't have a conversion function. Prepare for xdnd.
Declare variables.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- e_dnd.h     5 Oct 2005 19:35:13 -0000       1.21
+++ e_dnd.h     7 Oct 2005 18:36:53 -0000       1.22
@@ -21,8 +21,10 @@
 {
    E_Object             e_obj_inherit;
 
-   char         *type;
-   void         *data;
+   char         **types;
+   unsigned int   num_types;
+   void          *data;
+   int            data_size;
 
    struct {
        void (*finished)(E_Drag *drag, int dropped);
@@ -91,7 +93,9 @@
 EAPI int  e_dnd_active(void);
 
 /* 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,
+EAPI E_Drag *e_drag_new(E_Container *container, int x, int y,
+                       const char **types, unsigned int num_types,
+                       void *data, int size,
                        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);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- e_dnd.c     6 Oct 2005 18:36:53 -0000       1.33
+++ e_dnd.c     7 Oct 2005 18:36:53 -0000       1.34
@@ -136,11 +136,15 @@
 
 E_Drag*
 e_drag_new(E_Container *container, int x, int y,
-          const char *type, void *data,
+          const char **types, unsigned int num_types,
+          void *data, int size,
           void (*finished_cb)(E_Drag *drag, int dropped))
 {
    E_Drag *drag;
+   int i;
 
+   /* No need to create a drag object without type */
+   if (!num_types) return NULL;
    drag = E_OBJECT_ALLOC(E_Drag, E_DRAG_TYPE, _e_drag_free);
    if (!drag) return NULL;
 
@@ -175,8 +179,12 @@
    evas_object_resize(drag->object, drag->w, drag->h);
    ecore_evas_resize(drag->ecore_evas, drag->w, drag->h);
 
-   drag->type = strdup(type);
+   drag->types = malloc(num_types * sizeof(char *));
+   for (i = 0; i < num_types; i++)
+     drag->types[i] = strdup(types[i]);
+   drag->num_types = num_types;
    drag->data = data;
+   drag->data_size = size;
    drag->cb.finished = finished_cb;
 
    _drag_list = evas_list_append(_drag_list, drag);
@@ -274,7 +282,7 @@
        h->active = 0;
        for (i = 0; i < h->num_types; i++)
          {
-            if (!strcmp(h->types[i], drag->type))
+            if (!strcmp(h->types[i], drag->types[0]))
               h->active = 1;
          }
        h->entered = 0;
@@ -323,18 +331,18 @@
             if (!h->entered)
               {
                  if (h->cb.enter)
-                   h->cb.enter(h->cb.data, _drag_current->type, enter_ev);
+                   h->cb.enter(h->cb.data, _drag_current->types[0], enter_ev);
                  h->entered = 1;
               }
             if (h->cb.move)
-              h->cb.move(h->cb.data, _drag_current->type, move_ev);
+              h->cb.move(h->cb.data, _drag_current->types[0], move_ev);
          }
        else
          {
             if (h->entered)
               {
                  if (h->cb.leave)
-                   h->cb.leave(h->cb.data, _drag_current->type, leave_ev);
+                   h->cb.leave(h->cb.data, _drag_current->types[0], leave_ev);
                  h->entered = 0;
               }
          }
@@ -366,7 +374,7 @@
    if (_drag_current)
      {
        ev->data = _drag_current->data;
-       type = _drag_current->type;
+       type = _drag_current->types[0];
      }
    else if (_xdnd)
      {
@@ -565,6 +573,8 @@
 static void
 _e_drag_free(E_Drag *drag)
 {
+   int i;
+
    _drag_list = evas_list_remove(_drag_list, drag);
 
    E_FREE(drag->shape_rects);
@@ -575,7 +585,9 @@
    evas_object_del(drag->object);
    e_canvas_del(drag->ecore_evas);
    ecore_evas_free(drag->ecore_evas);
-   free(drag->type);
+   for (i = 0; i < drag->num_types; i++)
+     free(drag->types[i]);
+   free(drag->types);
    free(drag);
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.444
retrieving revision 1.445
diff -u -3 -r1.444 -r1.445
--- e_border.c  5 Oct 2005 19:02:41 -0000       1.444
+++ e_border.c  7 Oct 2005 18:36:53 -0000       1.445
@@ -4093,11 +4093,12 @@
                            Evas_Object *o = NULL;
                            Evas_Coord x, y, w, h;
                            const char *file = NULL, *part = NULL;
+                           const char *drag_types[] = { "enlightenment/border" 
};
 
                            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);
+                                             drag_types, 1, bd, -1, NULL);
                            edje_object_file_get(bd->icon_object, &file, &part);
                            if ((file) && (part))
                              {




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to