Thanks for your advice about patch.

I fixed below according to your advice.

1. check device id in multi up/down/move callbacks.
2. I made _multi_touch_motion_eval() function, 
    this function called by both mouse_up and multi_up.

If this patch have another issue, please let me know.

Thank you.

-----Original Message-----
From: Carsten Haitzler (The Rasterman) [mailto:ras...@rasterman.com] 
Sent: Tuesday, December 21, 2010 5:54 PM
To: Jeonghyun Yun
Cc: 'Daniel Juyung Seo'; enlightenment-devel@lists.sourceforge.net
Subject: Re: [E-devel] [Patch] elm_genlist multi-touch smart callbacks added

On Mon, 20 Dec 2010 15:56:11 +0900 Jeonghyun Yun <jh0506....@samsung.com>
said:

problem in code for patch... in your multi up/dwon/move callbacks you don't
check the device id. as such the core mouse or first touch is device "0" so
you
don't see multi events for it, but devices 1, 2, 3 etc. are the extra touch
points. your patch will get confused if you have 3 fingers on the screen as
it
will handle both finger #2 and #3 in those events, so you should have a if
(ev->device != 1) return; or something like that (to only handle the 2nd
touch
point).

another problem. you trigger this only on the "up" of the "2nd
finger" (assuming the above is fixed). what you need to do it handling this
on
ALL "up" events - mouse AND multi.. and IF no more fingers are touching on
one
of those up events (that means its the last finger to release), THEN figure
out
what to do. so you need to track the down state of main mouse and multi
event
with some flags/booleans and when both are false/0/off then both fingers are
released and you can check what to do. you already do it for multi with
wd->multitouched. make this as above for both mouse and multi and then a
separate "eval" call to evaluate what kind of motion the fingers did and
you're
looking good.

can you re-submit the patch with the above fixes?

> Hello,
> 
> I modified name and added doxyen. Please refer to below.
> 
> "multi,swipe,left" - This is called when the genlist is multi-touch swiped
> left.
> "multi,swipe,right" - This is called when the genlist is multi-touch
swiped
> right.
> "multi,swipe,up" - This is called when the genlist is multi-touch swiped
up.
> "multi,swpie,down" - This is called when the genlist is multi-touch swiped
> down.
> "multi,pinch,out" - This is called when the genlist is multi-touch pinched
> out.
> "multi,pinch,in" - This is called when the genlist is multi-touch pinched
> in.
> 
> If this patch have any issue, please let me know.
> 
> Thank you.
> 
> -----Original Message-----
> From: Daniel Juyung Seo [mailto:seojuyu...@gmail.com] 
> Sent: Monday, December 20, 2010 2:53 PM
> To: Jeonghyun Yun
> Cc: enlightenment-devel@lists.sourceforge.net
> Subject: Re: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
added
> 
> Hello,
> 
> How about using below names for smart callbacks?
> 
> "multi,swipe,left" - Genlist has been multi-touch swept left.
> "multi,swipe,right" - Genlist has been multi-touch swept right.
> "multi,swipe,up" - Genlist has been multi-touch swept top.
> "multi,swpie,down" - Genlist has been multi-touch swept bottom.
> "multi,pinch,out" - Genlist has been multi-touch pinched out.
> "multi,pinch,in" - Genlist has been multi-touch pinched in.
> 
> Because there is a "swipe" smart callbacks, I think we can use the
> name "swipe" here too.
> 
> And Mr. Yun, can you add doxygen for those events as well?
> Please add smart callback doxygen to elm_genlist.c.
> You can see existing doxygens at the top of elm_genlist.c
> So you may add "multi,**" doxygens around line number 78~80.
> 
> Thank you.
> Daniel Juyung Seo (SeoZ)
> 
> 
> 
> On Fri, Dec 17, 2010 at 5:28 PM, Jeonghyun Yun <jh0506....@samsung.com>
> wrote:
> > Dear SeoZ,
> >
> > Yes. I agree about using up & down instead of top & bottom.
> >
> > And I'm also not sure but 'sweep' is not bad.
> > Also 'move' is a good name. Then how about 'dragged'?
> >
> > I don't know well. Anybody please suggest a good name.
> >
> > Thanks.
> >
> > -----Original Message-----
> > From: Daniel Juyung Seo [mailto:seojuyu...@gmail.com]
> > Sent: Friday, December 17, 2010 4:40 PM
> > To: Jeonghyun Yun
> > Cc: enlightenment-devel@lists.sourceforge.net
> > Subject: Re: [E-devel] [Patch] elm_genlist multi-touch smart callbacks
> added
> >
> > Dear Yun,
> >
> > How about renaming some callbacks?
> > "multi,sweep,top" => "multi,sweep,up"
> > "multi,sweep,bottom" => "multi,sweep,down"
> > Multi touch event cares only for the touch behavior not the callback's
> > behavior.
> >
> > And I'm not sure it is ok to use the word 'sweep'.
> > Anybody please suggest a good name for this. Maybe 'move'?
> > I'm not sure about this.
> >
> > Anyway thanks for your effort.
> > Daniel Juyung Seo. (SeoZ)
> >
> >
> > On Fri, Dec 17, 2010 at 11:48 AM, Jeonghyun Yun <jh0506....@samsung.com>
> > wrote:
> >> Dear all,
> >>
> >> I added 6 multi-touch smart callbacks in elm_genlist, please refer to
> > below.
> >>
> >> "multi,sweep,left" - Genlist has been multi-touch swept left.
> >> "multi,sweep,right" - Genlist has been multi-touch swept right.
> >> "multi,sweep,top" - Genlist has been multi-touch swept top.
> >> "multi,sweep,bottom" - Genlist has been multi-touch swept bottom.
> >> "multi,pinch,out" - Genlist has been multi-touch pinched out.
> >> "multi,pinch,in" - Genlist has been multi-touch pinched in.
> >>
> >> I think these smart callbacks are very useful for elm_genlist
multi-touch
> >> effect.
> >>
> >> If this patch have any issue, please let me know.
> >>
> >> Thanks.
> >>
> >>
> >
>
----------------------------------------------------------------------------
> > --
> >> Lotusphere 2011
> >> Register now for Lotusphere 2011 and learn how
> >> to connect the dots, take your collaborative environment
> >> to the next level, and enter the era of Social Business.
> >> http://p.sf.net/sfu/lotusphere-d2d
> >> _______________________________________________
> >> enlightenment-devel mailing list
> >> enlightenment-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >>
> >>
> >
> >


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com
Index: src/lib/elm_genlist.c
===================================================================
--- src/lib/elm_genlist.c       (revision 55737)
+++ src/lib/elm_genlist.c       (working copy)
@@ -91,6 +91,24 @@
  * scroll,edge,right - This is called when the genlist is scrolled until the
  * right edge.
  *
+ * multi,swipe,left - This is called when the genlist is multi-touch swiped
+ * left.
+ *
+ * multi,swipe,right - This is called when the genlist is multi-touch swiped
+ * right.
+ *
+ * multi,swipe,up - This is called when the genlist is multi-touch swiped
+ * up.
+ *
+ * multi,swipe,down - This is called when the genlist is multi-touch swiped
+ * down.
+ *
+ * multi,pinch,out - This is called when the genlist is multi-touch pinched
+ * out.
+ *
+ * multi,pinch,in - This is called when the genlist is multi-touch pinched
+ * in.
+ *
  * Genlist has a fairly large API, mostly because it's relatively complex,
  * trying to be both expansive, powerful and efficient. First we will begin
  * an overview o the theory behind genlist.
@@ -283,6 +301,11 @@ struct _Widget_Data
    Elm_Genlist_Item *anchor_item;
    Evas_Coord        anchor_y;
    Elm_List_Mode     mode;
+   Evas_Coord        prev_x, prev_y, prev_mx, prev_my;
+   Evas_Coord        cur_x, cur_y, cur_mx, cur_my;
+   Eina_Bool         mouse_down : 1;
+   Eina_Bool         multi_down : 1;
+   Eina_Bool         multitouched : 1;
    Eina_Bool         on_hold : 1;
    Eina_Bool         multi : 1;
    Eina_Bool         always_select : 1;
@@ -299,6 +322,7 @@ struct _Widget_Data
    {
       Evas_Coord x, y;
    } history[SWIPE_MOVES];
+   int               multi_device;
    int               item_cache_count;
    int               item_cache_max;
    int               movements;
@@ -966,6 +990,12 @@ _mouse_move(void        *data,
                _item_unselect(it);
           }
      }
+   if (it->wd->multitouched)
+     {
+        it->wd->cur_x = ev->cur.canvas.x;
+        it->wd->cur_y = ev->cur.canvas.y;
+        return;
+     }
    if ((it->dragging) && (it->down))
      {
         if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
@@ -1095,6 +1125,124 @@ _swipe_cancel(void *data)
 }
 
 static void
+_multi_touch_motion_eval(void *data)
+{
+   Elm_Genlist_Item *it = data;
+
+   Evas_Coord minw = 0, minh = 0;
+   Evas_Coord off_x, off_y, off_mx, off_my;
+
+   elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+   off_x = abs(it->wd->cur_x - it->wd->prev_x);
+   off_y = abs(it->wd->cur_y - it->wd->prev_y);
+   off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
+   off_my = abs(it->wd->cur_my - it->wd->prev_my);
+
+   if ((off_x > minw) || (off_mx > minw) || (off_y > minh) || (off_my > minh))
+     {
+        if ((off_x + off_mx) > (off_y + off_my))
+          {
+             if((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > 
it->wd->prev_mx))
+               evas_object_smart_callback_call(it->base.widget,
+                                               "multi,swipe,right", it);
+             else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < 
it->wd->prev_mx))
+               evas_object_smart_callback_call(it->base.widget,
+                                               "multi,swipe,left", it);
+             else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x 
- it->wd->prev_mx))
+               evas_object_smart_callback_call(it->base.widget,
+                                               "multi,pinch,out", it);
+             else
+               evas_object_smart_callback_call(it->base.widget,
+                                               "multi,pinch,in", it);
+          }
+        else
+          {
+             if((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > 
it->wd->prev_my))
+               evas_object_smart_callback_call(it->base.widget,
+                                               "multi,swipe,down", it);
+             else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < 
it->wd->prev_my))
+               evas_object_smart_callback_call(it->base.widget,
+                                               "multi,swipe,up", it);
+             else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y 
- it->wd->prev_my))
+               evas_object_smart_callback_call(it->base.widget,
+                                               "multi,pinch,out", it);
+             else
+               evas_object_smart_callback_call(it->base.widget,
+                                               "multi,pinch,in", it);
+          }
+     }
+
+   it->wd->multitouched = EINA_FALSE;
+   it->wd->prev_x = 0;
+   it->wd->prev_y = 0;
+   it->wd->prev_mx = 0;
+   it->wd->prev_my = 0;
+}
+
+static void
+_multi_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void 
*event_info)
+{
+   Elm_Genlist_Item *it = data;
+   Evas_Event_Multi_Down *ev = event_info;
+   if (it->wd->multi_device == 0) it->wd->multi_device = ev->device;
+   if (it->wd->multi_device != ev->device) return;
+
+   it->wd->multi_down = EINA_TRUE;
+   it->wd->multitouched = EINA_TRUE;
+   it->wd->prev_mx = ev->canvas.x;
+   it->wd->prev_my = ev->canvas.y;
+
+   if (!it->wd->wasselected) _item_unselect(it);
+   it->wd->wasselected = EINA_FALSE;
+   it->wd->longpressed = EINA_FALSE;
+   if (it->long_timer)
+     {
+        ecore_timer_del(it->long_timer);
+        it->long_timer = NULL;
+     }
+   if (it->dragging)
+     {
+        it->dragging = EINA_FALSE;
+        evas_object_smart_callback_call(it->base.widget, "drag,stop", it);
+     }
+   if (it->swipe_timer)
+     {
+        ecore_timer_del(it->swipe_timer);
+        it->swipe_timer = NULL;
+     }
+   if (it->wd->on_hold)
+     {
+        it->wd->swipe = EINA_FALSE;
+        it->wd->movements = 0;
+        it->wd->on_hold = EINA_FALSE;
+     }
+}
+
+static void
+_multi_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void 
*event_info)
+{
+   Elm_Genlist_Item *it = data;
+   Evas_Event_Multi_Up *ev = event_info;
+
+   if (it->wd->multi_device != ev->device) return;
+   it->wd->multi_down = EINA_FALSE;
+   if (it->wd->mouse_down) return;
+   _multi_touch_motion_eval(data);
+}
+
+static void
+_multi_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void 
*event_info)
+{
+   Elm_Genlist_Item *it = data;
+   Evas_Event_Multi_Move *ev = event_info;
+
+   if (it->wd->multi_device != ev->device) return;
+   if( it->wd->prev_mx * it->wd->prev_my == 0 ) return;
+   it->wd->cur_mx = ev->cur.canvas.x;
+   it->wd->cur_my = ev->cur.canvas.y;
+}
+
+static void
 _mouse_down(void        *data,
             Evas *evas   __UNUSED__,
             Evas_Object *obj,
@@ -1115,6 +1263,9 @@ _mouse_down(void        *data,
    evas_object_geometry_get(obj, &x, &y, NULL, NULL);
    it->dx = ev->canvas.x - x;
    it->dy = ev->canvas.y - y;
+   it->wd->prev_x = ev->canvas.x;
+   it->wd->prev_y = ev->canvas.y;
+   it->wd->mouse_down = EINA_TRUE;
    it->wd->longpressed = EINA_FALSE;
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
    else it->wd->on_hold = EINA_FALSE;
@@ -1147,6 +1298,12 @@ _mouse_up(void            *data,
 
    if (ev->button != 1) return;
    it->down = EINA_FALSE;
+   it->wd->mouse_down = EINA_FALSE;
+   if (it->wd->multitouched)
+     {
+        if (!it->wd->multi_down) _multi_touch_motion_eval(data);
+        return;
+     }
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
    else it->wd->on_hold = EINA_FALSE;
    if (it->long_timer)
Index: AUTHORS
===================================================================
--- AUTHORS     (revision 55737)
+++ AUTHORS     (working copy)
@@ -31,3 +31,4 @@ Daniel Juyung Seo (SeoZ) <juyung....@samsung.com>
 Sangho Park <sangho.g.p...@samsung.com> <gouach...@gmail.com>
 Rajeev Ranjan (Rajeev) <rajee...@samsung.com> <rajeev.jn...@gmail.com>
 Seunggyun Kim <sgyun....@samsung.com> <tmd...@gmail.com>
+Jeonghyun Yun (arosis) <jh0506....@samsung.com>
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to