* edje: Oops, fix drag.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 11 Aug 2009 14:55:26 +0000 (14:55 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 11 Aug 2009 14:55:26 +0000 (14:55 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@41691 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_callbacks.c
src/lib/edje_load.c
src/lib/edje_private.h

index 84e3d58..058486b 100644 (file)
@@ -89,12 +89,12 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
        _edje_emit(ed, buf, rp->part->name);
      }
 
-   if (rp->drag && rp->drag->events_to)
+   if (rp->events_to)
      {
        int x = 0, y = 0;
        Edje_Real_Part *events;
 
-       events = rp->drag->events_to;
+       events = rp->events_to;
        evas_object_geometry_get(rp->object, &x, &y, NULL, NULL);
 
        if ((events->part->dragable.x) || (events->part->dragable.y))
@@ -121,48 +121,49 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
 #endif
          }
        _edje_recalc_do(ed);
-/*
-       _edje_thaw(ed);
-       _edje_unref(ed);
-       _edje_ref(ed);
-       _edje_freeze(ed);
-*/
+       /*
+         _edje_thaw(ed);
+         _edje_unref(ed);
+         _edje_ref(ed);
+         _edje_freeze(ed);
+       */
        rp = events;
-         {
-            double dx = 0.0, dy = 0.0;
-            int dir;
-
-            dir = _edje_part_dragable_calc(ed, rp, &dx, &dy);
-            
-            if ((dx != rp->drag->val.x) || (dy != rp->drag->val.y))
-              {
-                 rp->drag->val.x = dx;
-                 rp->drag->val.y = dy;
-                 if (!ignored)
-                   _edje_emit(ed, "drag", rp->part->name);
-                 ed->dirty = 1;
+       {
+          double dx = 0.0, dy = 0.0;
+          int dir;
+
+          dir = _edje_part_dragable_calc(ed, rp, &dx, &dy);
+
+          if ((dx != rp->drag->val.x) || (dy != rp->drag->val.y))
+            {
+               rp->drag->val.x = dx;
+               rp->drag->val.y = dy;
+               if (!ignored)
+                 _edje_emit(ed, "drag", rp->part->name);
+               ed->dirty = 1;
 #ifdef EDJE_CALC_CACHE
-                 rp->invalidate = 1;
+               rp->invalidate = 1;
 #endif
-                 rp->drag->need_reset = 1;
-                 _edje_recalc_do(ed);
-              }
-         }
+               rp->drag->need_reset = 1;
+               _edje_recalc_do(ed);
+            }
+       }
      }
 
-   if ((rp->part->dragable.x) || (rp->part->dragable.y))
+   if (rp->drag)
      {
        if (rp->drag->down.count == 0)
          {
             if (rp->part->dragable.x)
-                rp->drag->down.x = ev->canvas.x;
+              rp->drag->down.x = ev->canvas.x;
             if (rp->part->dragable.y)
-                rp->drag->down.y = ev->canvas.y;
+              rp->drag->down.y = ev->canvas.y;
             if (!ignored)
               _edje_emit(ed, "drag,start", rp->part->name);
          }
        rp->drag->down.count++;
      }
+
    if (rp->clicked_button == 0)
      {
        rp->clicked_button = ev->button;
@@ -200,18 +201,18 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
        _edje_emit(ed, buf, rp->part->name);
      }
 
-   if (rp->drag)
+   if (rp->events_to)
      {
-       if (rp->drag->events_to)
+       rp = rp->events_to;
+       if (!ignored)
          {
-            rp = rp->drag->events_to;
-            if (!ignored)
-              {
-                 snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
-                 _edje_emit(ed, buf, rp->part->name);
-              }
+            snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
+            _edje_emit(ed, buf, rp->part->name);
          }
+     }
 
+   if (rp->drag)
+     {
        if (rp->drag->down.count > 0)
          {
             rp->drag->down.count--;
@@ -255,7 +256,7 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
    ed = data;
    rp = evas_object_data_get(obj, "real_part");
    if (!rp) return;
-   if (rp->drag && rp->drag->events_to) rp = rp->drag->events_to;
+   if (rp->events_to) rp = rp->events_to;
 
    ignored = rp->part->ignore_flags & ev->event_flags;
 
index ae08405..2b25b51 100644 (file)
@@ -479,17 +479,17 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
                         {
                            if (rp->part->dragable.confine_id >= 0)
                              rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
+                        }
 
-                           /* replay events for dragable */
-                           if (rp->part->dragable.events_id >= 0)
-                             {
-                                rp->drag->events_to =
-                                  ed->table_parts[rp->part->dragable.events_id % ed->table_parts_size];
-                                /* events_to may be used only with dragable */
-                                if (!rp->drag->events_to->part->dragable.x &&
-                                    !rp->drag->events_to->part->dragable.y)
-                                  rp->drag->events_to = NULL;
-                             }
+                      /* replay events for dragable */
+                      if (rp->part->dragable.events_id >= 0)
+                        {
+                           rp->events_to =
+                             ed->table_parts[rp->part->dragable.events_id % ed->table_parts_size];
+                           /* events_to may be used only with dragable */
+                           if (!rp->events_to->part->dragable.x &&
+                               !rp->events_to->part->dragable.y)
+                             rp->events_to = NULL;
                         }
 
                       rp->swallow_params.min.w = 0;
index d88ed5d..825b676 100644 (file)
@@ -785,9 +785,8 @@ struct _Edje_Real_Part_Drag
       int               x, y; // 8
    } tmp;
    unsigned char        need_reset : 1; // 4
-   Edje_Real_Part      *events_to; // 4
    Edje_Real_Part       *confine_to; // 4
-}; // 104 // FIME: make drag pointer to struct optional
+}; // 104
 
 struct _Edje_Real_Part
 {
@@ -809,6 +808,7 @@ struct _Edje_Real_Part
    } swallow_params; // 28 // FIXME: only if type SWALLOW
 
    Edje_Real_Part_Drag      *drag; // 4
+   Edje_Real_Part          *events_to; // 4
 
    struct {
       Edje_Real_Part        *source; // 4
@@ -856,8 +856,8 @@ struct _Edje_Real_Part
 #ifdef EDJE_CALC_CACHE
    unsigned char             invalidate : 1;
 #endif
-}; //  294
-// WITH EDJE_CALC_CACHE: 774
+}; //  298
+// WITH EDJE_CALC_CACHE: 778
 
 struct _Edje_Running_Program
 {